forked from domwashburn/postcss-parent-selector
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
37 lines (31 loc) · 939 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
import postcss from 'postcss';
import test from 'ava';
import plugin from './index.js';
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('selector is added to all rules', t => {
return run(
t,
'.foo, bar .baz, .buzz .bam { }',
'.parent .foo, .parent bar .baz, .parent .buzz .bam { }',
{ selector: '.parent' });
});
test('selector not added when rule starts with defined selector', t => {
return run(
t,
'.parent, .foo { }',
'.parent, .parent .foo { }',
{ selector: '.parent' });
});
test('does not add parent class to keyframes names', t => {
return run(
t,
'@keyframes foo { }',
'@keyframes foo { }',
{ selector: '.parent' });
});