/
issue26.js
45 lines (38 loc) · 911 Bytes
/
issue26.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
import postcss from 'postcss';
import nano from '..';
const fixture = `
@media print {
.test {
-webkit-border-radius: 0;
border-radius: 0;
}
}
@media print {
.test {
-webkit-box-shadow: none;
box-shadow: none;
}
}
.test {
width: 500px;
}
`;
const expected = `@media print{.test{-webkit-border-radius:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}}.test{width:500px}`;
test('it should compress whitespace after node.clone()', () => {
const plugin = () => {
return {
postcssPlugin: 'cloner',
Once(root) {
root.walkAtRules((rule) => {
root.prepend(rule.clone());
rule.remove();
});
},
};
};
plugin.postcss = true;
const processor = postcss([plugin, nano()]);
return processor
.process(fixture, { from: undefined })
.then((r) => expect(r.css).toBe(expected));
});