@@ -40,7 +40,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
40
40
harness . expectFile ( 'dist/index.html' ) . content . toContain ( `body{color:#000;}` ) ;
41
41
} ) ;
42
42
43
- it ( `should not extract critical css when 'optimization' is unset` , async ( ) => {
43
+ it ( `should extract critical css when 'optimization' is unset` , async ( ) => {
44
44
harness . useTarget ( 'build' , {
45
45
...BASE_OPTIONS ,
46
46
styles : [ 'src/styles.css' ] ,
@@ -50,10 +50,15 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
50
50
const { result } = await harness . executeOnce ( ) ;
51
51
52
52
expect ( result ?. success ) . toBe ( true ) ;
53
- harness . expectFile ( 'dist/index.html' ) . content . not . toContain ( `<style` ) ;
53
+ harness
54
+ . expectFile ( 'dist/index.html' )
55
+ . content . toContain (
56
+ `<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">` ,
57
+ ) ;
58
+ harness . expectFile ( 'dist/index.html' ) . content . toContain ( `body{color:#000;}` ) ;
54
59
} ) ;
55
60
56
- it ( `should not extract critical css when 'optimization' is true` , async ( ) => {
61
+ it ( `should extract critical css when 'optimization' is true` , async ( ) => {
57
62
harness . useTarget ( 'build' , {
58
63
...BASE_OPTIONS ,
59
64
styles : [ 'src/styles.css' ] ,
@@ -63,7 +68,12 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
63
68
const { result } = await harness . executeOnce ( ) ;
64
69
65
70
expect ( result ?. success ) . toBe ( true ) ;
66
- harness . expectFile ( 'dist/index.html' ) . content . not . toContain ( `<style` ) ;
71
+ harness
72
+ . expectFile ( 'dist/index.html' )
73
+ . content . toContain (
74
+ `<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">` ,
75
+ ) ;
76
+ harness . expectFile ( 'dist/index.html' ) . content . toContain ( `body{color:#000;}` ) ;
67
77
} ) ;
68
78
69
79
it ( `should not extract critical css when 'optimization' is false` , async ( ) => {
0 commit comments