-
-
Notifications
You must be signed in to change notification settings - Fork 608
/
Copy pathsimpleTest.js
55 lines (53 loc) · 1.73 KB
/
simpleTest.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
/*globals describe */
var assert = require('assert');
var test = require("./helpers").test;
var testError = require("./helpers").testError;
var testMinimize = require("./helpers").testMinimize;
describe("simple", function() {
test("empty", "", [
[1, "", ""]
]);
testMinimize("empty minimized", "", [
[1, "", ""]
]);
test("simple", ".class { a: b c d; }", [
[1, ".class { a: b c d; }", ""]
]);
test("simple2", ".class { a: b c d; }\n.two {}", [
[1, ".class { a: b c d; }\n.two {}", ""]
]);
test("escaped selector", ".u-m\\+ { a: b c d; }", [
[1, ".u-m\\+ { a: b c d; }", ""]
]);
test("escaped characters (uppercase)", ".class { content: \"\\F10C\" }", [
[1, ".class { content: \"\\F10C\" }", ""]
]);
// Need uncomment after resolve https://github.com/css-modules/postcss-modules-local-by-default/issues/108
/*test("escape characters (lowercase)", ".class { content: \"\\f10C\" }", [
[1, ".class { content: \"\\f10C\" }", ""]
]);*/
// Need uncomment after resolve https://github.com/mathiasbynens/cssesc/issues/10
/*test("escape characters (two)", ".class { content: \"\\F10C \\F10D\" }", [
[1, ".class { content: \"\\F10C \\F10D\" }", ""]
]);*/
testMinimize("minimized simple", ".class { a: b c d; }", [
[1, ".class{a:b c d}", ""]
]);
test("charset directive", "@charset \"UTF-8\";\n .class { a: b c d; }", [
[1, "@charset \"UTF-8\";\n .class { a: b c d; }", ""]
]);
test("custom variables", ":root {--foo: 1px;\n--bar: 2px;}", [
[1, ":root {--foo: 1px;\n--bar: 2px;}", ""]
]);
testError("error formatting", ".some {\n invalid css;\n}", function(err) {
assert.equal(err.message, [
'Unknown word (2:2)',
'',
' 1 | .some {',
'> 2 | invalid css;',
' | ^',
' 3 | }',
'',
].join('\n'));
});
});