-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.js
More file actions
60 lines (49 loc) · 1.62 KB
/
Copy pathtest.js
File metadata and controls
60 lines (49 loc) · 1.62 KB
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
var assert = require('assert');
var postcss = require('postcss');
const plugin = require('./plugin');
const process = (css, opts) =>
postcss([plugin(opts)]).process(css).then(({ css }) => css);
describe('plugin', () => {
it('should process grouped rules', () => process(
'.a {}'
).then(css => assert.equal(css,
':global :local(.style) .a {}'
)));
it('should process grouped rules', () => process(
'.a, .b {}'
).then(css => assert.equal(css,
':global :local(.style) .a, :global :local(.style) .b {}'
)));
it('should process combined rules', () => process(
'.a {}', { combine: true }
).then(css => assert.equal(css,
':global .a:local(.style) {}'
)));
it('should process combined grouped rules', () => process(
'.a, .b {}', { combine: true }
).then(css => assert.equal(css,
':global .a:local(.style), :global .b:local(.style) {}'
)));
it('should process combined child rules', () => process(
'.a .b {}', { combine: true }
).then(css => assert.equal(css,
':global .a:local(.style) .b {}'
)));
it('should process combined child rules with newline', () => process(
`.a
.b {}`, { combine: true }
).then(css => assert.equal(css,
`:global .a:local(.style)
.b {}`
)));
it('should process combined & descendant', () => process(
'.a .b {}', { combine: true, descendant: true }
).then(css => assert.equal(css,
':global .a:local(.style) .b, :global :local(.style) .a .b {}'
)));
it('should process rootClass', () => process(
'.a .b {}', { rootClass: 'rootClass' }
).then(css => assert.equal(css,
':global .rootClass .a .b {}'
)));
});