@@ -26,13 +26,9 @@ test('it fetches css from a page with CSS in a server generated <link> inside th
2626 const url = '/server-link-head'
2727 server . get ( url , ( req , res ) => {
2828 res . send ( `
29- <!doctype>
30- <html>
31- <head>
32- <link rel="stylesheet" href="fixture.css" />
33- </head>
34- </html>
35- ` )
29+ <!doctype html>
30+ <link rel="stylesheet" href="fixture.css" />
31+ ` )
3632 } )
3733
3834 const actual = await extractCss ( server . url + url )
@@ -44,13 +40,9 @@ test('it fetches css from a page with CSS in server generated <style> inside the
4440 const url = '/server-style-head'
4541 server . get ( url , ( req , res ) => {
4642 res . send ( `
47- <!doctype>
48- <html>
49- <head>
50- <style>${ expected . trim ( ) } </style>
51- </head>
52- </html>
53- ` )
43+ <!doctype html>
44+ <style>${ expected . trim ( ) } </style>
45+ ` )
5446 } )
5547
5648 const actual = await extractCss ( server . url + url )
@@ -104,6 +96,7 @@ test('it combines server generated <link> and <style> tags with client side crea
10496
10597 t . snapshot ( actual )
10698 t . true ( actual . includes ( 'counter-increment: 2;' ) )
99+ t . true ( actual . includes ( 'counter-increment: 3;' ) )
107100} )
108101
109102test ( 'it rejects if the url has an HTTP error status' , async t => {
@@ -119,20 +112,24 @@ test('it rejects on an invalid url', async t => {
119112
120113test ( 'it accepts a browser override for usage with other browsers' , async t => {
121114 const path = '/browser-override'
122- const kitchenSinkExample = readFileSync (
123- resolve ( __dirname , 'kitchen-sink.html' ) ,
124- 'utf8'
125- )
126115 server . get ( path , ( req , res ) => {
127- res . send ( kitchenSinkExample )
116+ res . send ( `
117+ <!doctype html>
118+ <style>
119+ body::before {
120+ content: ${ req . headers [ 'user-agent' ] } ;
121+ }
122+ </style>
123+ ` )
128124 } )
129125 const customBrowser = await puppeteerCore . launch ( {
130- executablePath : chromium . path
126+ executablePath : chromium . path ,
127+ args : [ "--user-agent='Extract CSS Core'" ]
131128 } )
132129 const actual = await extractCss ( server . url + path , { customBrowser} )
133130
134131 t . snapshot ( actual )
135- t . true ( actual . includes ( 'counter-increment: 2;' ) )
132+ t . true ( actual . includes ( "content: 'Extract CSS Core';" ) )
136133} )
137134
138135test ( 'it rejects on an invalid customBrowser option' , async t => {
0 commit comments