-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.js
86 lines (73 loc) · 1.44 KB
/
test.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict';
import postcss from 'postcss';
import test from 'ava';
import plugin from './';
function run(t, input, expected, opts = { }) {
return postcss([ plugin(opts) ]).process(input)
.then( result => {
t.deepEqual(result.css, expected);
t.deepEqual(result.warnings().length, 0);
});
}
test('base', t => {
return run(t,
`.input:valid {
background: green;
}
.input:user-invalid {
background: red;
}
:required {
content: "No extended behavior";
}
.input:user-invalid:out-of-range {
content: ":valid";
}`,
`.input:valid, .input.hf-valid {
background: green;
}
.input:user-invalid, .input.hf-user-invalid {
background: red;
}
:required {
content: "No extended behavior";
}
.input:user-invalid:out-of-range, .input.hf-user-invalid.hf-out-of-range {
content: ":valid";
}`
);
});
test('extended', t => {
return run(t,
`.input:valid {
background: green;
}
div:disabled {
opacity: 0;
}
:read-only, :optional :disabled {
color: gray;
}
:in-range:required {
content: ":required";
}
.input:user-invalid {
background: red;
}`,
`.input:valid, .input.hf-valid {
background: green;
}
div:disabled, div[disabled] {
opacity: 0;
}
:read-only, :optional :disabled, [readonly], :not([required]) [disabled] {
color: gray;
}
:in-range:required, .hf-in-range[required] {
content: ":required";
}
.input:user-invalid, .input.hf-user-invalid {
background: red;
}`,
{ extended: true });
});