@@ -15,12 +15,11 @@ const STYLE_LANGS: Array<[string, string]> = [
15
15
16
16
STYLE_LANGS . forEach ( ( [ lang , ext ] ) => {
17
17
describe ( `style - preprocessor - ${ lang } ` , ( ) => {
18
- const template = `<div></div><style lang="${ lang } ">${ getFixtureContent (
19
- `style.${ ext } ` ,
20
- ) } </style>`;
21
- const templateExternal = `<div></div><style src="./fixtures/style.${ ext } "></style>` ;
22
-
23
18
it ( `should throw parsing ${ lang } when { ${ lang } : false }` , async ( ) => {
19
+ const template = `<div></div><style lang="${ lang } ">${ getFixtureContent (
20
+ `style.${ ext } ` ,
21
+ ) } </style>`;
22
+
24
23
const opts = getAutoPreprocess ( {
25
24
[ lang ] : false ,
26
25
} ) ;
@@ -29,17 +28,40 @@ STYLE_LANGS.forEach(([lang, ext]) => {
29
28
} ) ;
30
29
31
30
it ( `should parse ${ lang } ` , async ( ) => {
31
+ const template = `<div></div><style lang="${ lang } ">${ getFixtureContent (
32
+ `style.${ ext } ` ,
33
+ ) } </style>`;
34
+
32
35
const opts = getAutoPreprocess ( ) ;
33
36
const preprocessed = await preprocess ( template , opts ) ;
34
37
35
38
expect ( preprocessed . toString ( ) ) . toMatch ( CSS_PATTERN ) ;
36
39
} ) ;
37
40
38
41
it ( `should parse external ${ lang } ` , async ( ) => {
42
+ const templateExternal = `<div></div><style src="./fixtures/style.${ ext } "></style>` ;
43
+ const opts = getAutoPreprocess ( ) ;
44
+ const preprocessed = await preprocess ( templateExternal , opts ) ;
45
+
46
+ expect ( preprocessed . toString ( ) ) . toMatch ( CSS_PATTERN ) ;
47
+ } ) ;
48
+
49
+ it ( `should parse external ${ lang } ` , async ( ) => {
50
+ const templateExternal = `<div></div><style src="./fixtures/style.${ ext } "></style>` ;
39
51
const opts = getAutoPreprocess ( ) ;
40
52
const preprocessed = await preprocess ( templateExternal , opts ) ;
41
53
42
54
expect ( preprocessed . toString ( ) ) . toMatch ( CSS_PATTERN ) ;
43
55
} ) ;
56
+
57
+ it ( `should return empty if content is empty` , async ( ) => {
58
+ const templateExternal = `<div></div><style src="./potato/style.${ ext } "></style>` ;
59
+ const opts = getAutoPreprocess ( {
60
+ [ lang ] : { sourceMap : false , sourcemap : false , map : false } ,
61
+ } ) ;
62
+ const preprocessed = await preprocess ( templateExternal , opts ) ;
63
+
64
+ expect ( preprocessed . toString ( ) ) . toMatch ( templateExternal ) ;
65
+ } ) ;
44
66
} ) ;
45
67
} ) ;
0 commit comments