-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
51 lines (47 loc) · 1004 Bytes
/
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
import postcss from 'postcss';
import test from 'ava';
import plugin from './';
const input = `
.a {
margin-top: rv(whitespace);
padding: rv(whitespaceSmall) rv(whitespace) 0;
}
`;
const output = `
.a {
margin-top: 1.6rem;
padding: 1rem 1.6rem 0;
}
@media (min-width: 640px) {
.a {
margin-top: 2rem;
padding: 1.4rem 2rem 0;
}
}
`;
const options = {
values: {
whitespaceSmall: {
value: '1rem',
queries: {
'(min-width: 640px)': '1.4rem'
}
},
whitespace: {
value: '1.6rem',
queries: {
'(min-width: 640px)': '2rem'
}
}
}
}
function run(t, input, output, opts = {}) {
return postcss([ plugin(opts) ]).process(input)
.then( result => {
t.deepEqual(result.css, output);
t.deepEqual(result.warnings().length, 0);
});
}
test('does something', t => {
return run(t, input, output, options);
});