-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.js
42 lines (39 loc) · 859 Bytes
/
index.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
const postcss = require('postcss');
const plugin = require('./');
const testCss = `
.test1::backdrop {
background-color: #fff;
}
.test1[open="true"]::backdrop {
background-color: #999;
}
.test2::backdrop, .test2 + .backdrop {
background-color: #000;
}
`;
async function run (input, output) {
let result = await postcss([plugin()])
.process(input, { from: undefined });
expect(result.css).toEqual(output);
expect(result.warnings()).toHaveLength(0);
}
it('convert css sucessufully', async () => {
const resultCss = `
.test1::backdrop {
background-color: #fff;
}
.test1 + .backdrop {
background-color: #fff;
}
.test1[open="true"]::backdrop {
background-color: #999;
}
.test1[open="true"] + .backdrop {
background-color: #999;
}
.test2::backdrop, .test2 + .backdrop {
background-color: #000;
}
`;
await run(testCss, resultCss)
});