forked from ledniy/postcss-prepend-selector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
30 lines (23 loc) · 777 Bytes
/
Copy pathtest.js
File metadata and controls
30 lines (23 loc) · 777 Bytes
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
import postcss from 'postcss';
import test from 'ava';
import plugin from './';
function run(t, input, output, opts = {}) {
return postcss([plugin(opts)]).process(input)
.then(result => {
t.is(result.css, output);
t.is(result.warnings().length, 0);
});
}
const selector = '.selector ';
test('Prepend selector', t =>
run(t, 'a{ }', '.selector a{ }', { selector })
);
test('Prepend selectors', t =>
run(t, 'a, .example{ }', '.selector a, .selector .example{ }', { selector })
);
test('Should not prepend if class is already there', t =>
run(t, '.selector.example{ }', '.selector.example{ }', { selector })
);
test('Skip keyframe rules', t =>
run(t, '0%, from {} 100%, to {}', '0%, from {} 100%, to {}', { selector })
);