/
importTest.js
48 lines (46 loc) · 1.57 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
/*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 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 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");
});