@@ -20,23 +20,25 @@ test('it finds css in a <link> tag - HTML', async t => {
20
20
21
21
t . true ( actual . includes ( '.link-in-html { }' ) )
22
22
t . true ( actual . includes ( '@import url("import-in-css.css")' ) )
23
- t . true ( actual . includes ( '.css-imported-with-css {}' ) )
23
+ t . true ( actual . includes ( '.css-imported-with-css { }' ) )
24
+ t . snapshot ( actual )
24
25
} )
25
26
26
27
test ( 'it finds css in a <link> tag - JS' , async t => {
27
28
const actual = await extractCss ( server . url + '/link-tag-js.html' )
28
29
29
- t . true ( actual . includes ( '.link-tag-created-with-js {} ' ) )
30
+ t . true ( actual . includes ( '.link-tag-created-with-js' ) )
30
31
t . true ( actual . includes ( '@import url("import-in-css.css")' ) )
31
- t . true ( actual . includes ( '.css-imported-with-css {}' ) )
32
+ t . true ( actual . includes ( '.css-imported-with-css { }' ) )
33
+ t . snapshot ( actual )
32
34
} )
33
35
34
36
test ( 'it finds css in a <style> tag - HTML' , async t => {
35
37
const actual = await extractCss ( server . url + '/style-tag-html.html' )
36
38
37
39
t . true ( actual . includes ( '.fixture { color: red; }' ) )
38
40
t . true ( actual . includes ( '@import url("import-in-css.css")' ) )
39
- t . true ( actual . includes ( '.css-imported-with-css {}' ) )
41
+ t . true ( actual . includes ( '.css-imported-with-css { }' ) )
40
42
t . snapshot ( actual )
41
43
} )
42
44
@@ -49,14 +51,15 @@ test('it reports CSS in a <style> tag in HTML only once', async t => {
49
51
const lastOccurence = actual . lastIndexOf ( '.fixture' )
50
52
51
53
t . is ( firstOccurence , lastOccurence )
54
+ t . snapshot ( actual )
52
55
} )
53
56
54
57
test ( 'it finds css in a <style> tag - JS' , async t => {
55
58
const actual = await extractCss ( server . url + '/style-tag-js.html' )
56
59
57
60
t . true ( actual . includes ( '.fixture { color: red; }' ) )
58
61
t . true ( actual . includes ( '@import url("import-in-js.css")' ) )
59
- t . true ( actual . includes ( '.css-imported-with-js {}' ) )
62
+ t . true ( actual . includes ( '.css-imported-with-js { }' ) )
60
63
t . snapshot ( actual )
61
64
} )
62
65
@@ -72,11 +75,12 @@ test('it finds CSS implemented in a mixed methods (inline, links, style tags)',
72
75
const actual = await extractCss ( server . url + '/kitchen-sink.html' )
73
76
74
77
t . true ( actual . includes ( '@import url("import-in-css.css")' ) )
75
- t . true ( actual . includes ( '.css-imported-with-css {}' ) )
78
+ t . true ( actual . includes ( '.css-imported-with-css { }' ) )
76
79
t . true ( actual . includes ( '[x-extract-css-inline-style]' ) )
77
80
t . true ( actual . includes ( '[x-extract-css-inline-style] { background-image: url(\'background-image-inline-style-attribute-in-html\'); }' ) )
78
81
t . true ( actual . includes ( '[x-extract-css-inline-style] { background-image: url("background-image-inline-style-js-cssText"); }' ) )
79
82
t . true ( actual . includes ( '[x-extract-css-inline-style] { background-image: url("background-image-inline-style-js-with-prop"); }' ) )
83
+ t . snapshot ( actual )
80
84
} )
81
85
82
86
test ( 'it finds inline styles - HTML' , async t => {
@@ -111,13 +115,13 @@ test('it returns an array of entries when the `origins` option equals `include`'
111
115
} )
112
116
113
117
t . true ( Array . isArray ( actual ) , 'Result should be an array when { origins: `include` }' )
114
- t . is ( actual . length , 10 )
118
+ t . is ( actual . length , 12 )
115
119
116
120
function isString ( item ) {
117
121
return typeof item === 'string'
118
122
}
119
123
120
- t . true ( actual . every ( item => isString ( item . type ) && [ 'link-or- import' , 'style' , 'inline' ] . includes ( item . type ) ) )
124
+ t . true ( actual . every ( item => isString ( item . type ) && [ 'link' , ' import', 'style' , 'inline' ] . includes ( item . type ) ) )
121
125
t . true ( actual . every ( item => isString ( item . href ) ) )
122
126
t . true ( actual . every ( item => item . href . startsWith ( 'http://localhost:' ) && / \. ( h t m l | c s s ) $ / . test ( item . href ) ) )
123
127
t . true ( actual . every ( item => isString ( item . css ) ) )
0 commit comments