forked from webpack-contrib/css-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimportTest.js
69 lines (67 loc) · 2.56 KB
/
importTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*globals describe */
var test = require("./helpers").test;
describe("import", function() {
test("import", "@import url(test.css);\n.class { a: b c d; }", [
[2, ".test{a: b}", ""],
[1, ".class { a: b c d; }", ""]
], "", {
"./test.css": [[2, ".test{a: b}", ""]]
});
test("import camelcase", "@IMPORT url(test.css);\n.class { a: b c d; }", [
[2, ".test{a: b}", ""],
[1, ".class { a: b c d; }", ""]
], "", {
"./test.css": [[2, ".test{a: b}", ""]]
});
test("import empty url", "@import url();\n.class { a: b c d; }", [
[1, "@import url();\n.class { a: b c d; }", ""]
], "");
test("import empty url with quotes", "@import url('');\n.class { a: b c d; }", [
[1, "@import url('');\n.class { a: b c d; }", ""]
], "");
test("import with string", "@import \"test.css\";\n.class { a: b c d; }", [
[2, ".test{a: b}", ""],
[1, ".class { a: b c d; }", ""]
], "", {
"./test.css": [[2, ".test{a: b}", ""]]
});
test("import with empty string", "@import \"\";\n.class { a: b c d; }", [
[1, "@import \"\";\n.class { a: b c d; }", ""]
], "");
test("import with string contain spaces", "@import \" \";\n.class { a: b c d; }", [
[1, "@import \" \";\n.class { a: b c d; }", ""]
], "");
test("import with string contain newline", "@import \"\n\";\n.class { a: b c d; }", [
[1, "@import \"\n\";\n.class { a: b c d; }", ""]
], "");
test("import with string contain CRLF", "@import \"\r\n\";\r\n.class { a: b c d; }", [
[1, "@import \"\r\n\";\r\n.class { a: b c d; }", ""]
], "");
test("import with string contain tab", "@import \"\t\";\n.class { a: b c d; }", [
[1, "@import \"\t\";\n.class { a: b c d; }", ""]
], "");
test("import 2", "@import url('test.css');\n.class { a: b c d; }", [
[2, ".test{a: b}", "screen"],
[1, ".class { a: b c d; }", ""]
], "", {
"./test.css": [[2, ".test{a: b}", "screen"]]
});
test("import with media", "@import url('~test/css') screen and print;\n.class { a: b c d; }", [
[3, ".test{a: b}", "((min-width: 100px)) and (screen and print)"],
[2, ".test{c: d}", "screen and print"],
[1, ".class { a: b c d; }", ""]
], "", {
"test/css": [
[3, ".test{a: b}", "(min-width: 100px)"],
[2, ".test{c: d}", ""]
]
});
test("import external", "@import url(http://example.com/style.css);\n@import url(\"//example.com/style.css\");", [
[1, "@import url(http://example.com/style.css);", ""],
[1, "@import url(//example.com/style.css);", ""],
[1, "", ""]
]);
test("import disabled", "@import url(test.css);\n.class { a: b c d; }", [
[1, "@import url(test.css);\n.class { a: b c d; }", ""]
], "?-import");
});