@@ -40,7 +40,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
4040 harness . expectFile ( 'dist/index.html' ) . content . toContain ( `body{color:#000;}` ) ;
4141 } ) ;
4242
43- it ( `should not extract critical css when 'optimization' is unset` , async ( ) => {
43+ it ( `should extract critical css when 'optimization' is unset` , async ( ) => {
4444 harness . useTarget ( 'build' , {
4545 ...BASE_OPTIONS ,
4646 styles : [ 'src/styles.css' ] ,
@@ -50,10 +50,15 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
5050 const { result } = await harness . executeOnce ( ) ;
5151
5252 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;}` ) ;
5459 } ) ;
5560
56- it ( `should not extract critical css when 'optimization' is true` , async ( ) => {
61+ it ( `should extract critical css when 'optimization' is true` , async ( ) => {
5762 harness . useTarget ( 'build' , {
5863 ...BASE_OPTIONS ,
5964 styles : [ 'src/styles.css' ] ,
@@ -63,7 +68,12 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
6368 const { result } = await harness . executeOnce ( ) ;
6469
6570 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;}` ) ;
6777 } ) ;
6878
6979 it ( `should not extract critical css when 'optimization' is false` , async ( ) => {
0 commit comments