|
1 | 1 | import test from 'ava';
|
2 | 2 | import postcss from 'postcss';
|
3 |
| -import plugin from '../src/'; |
| 3 | +import plugin from '../src'; |
4 | 4 |
|
5 | 5 | const processing = (inputCSS, options) => postcss([plugin(options)]).process(inputCSS).css;
|
6 | 6 |
|
7 | 7 | test('processing not options and not attribute selector', t => {
|
8 |
| - const expected = '.class, .test { color:red; }'; |
9 |
| - const fixtures = '.class, .test { color:red; }'; |
10 |
| - t.is(processing(fixtures), expected); |
| 8 | + const expected = '.class, .test { color:red; }'; |
| 9 | + const fixtures = '.class, .test { color:red; }'; |
| 10 | + t.is(processing(fixtures), expected); |
11 | 11 | });
|
12 | 12 |
|
13 | 13 | test('processing options prefix and not attribute selector', t => {
|
14 |
| - const expected = '.class { color:red; }'; |
15 |
| - const fixtures = '.class { color:red; }'; |
16 |
| - t.is(processing(fixtures, {prefix: 'test-'}), expected); |
| 14 | + const expected = '.class { color:red; }'; |
| 15 | + const fixtures = '.class { color:red; }'; |
| 16 | + t.is(processing(fixtures, {prefix: 'test-'}), expected); |
17 | 17 | });
|
18 | 18 |
|
19 | 19 | test('processing options prefix multiple', t => {
|
20 |
| - const expected = '.class, [type="test-text"], [class*="test-lorem-1 test-lorem-2"], [id^="test-myID"] { color:red; }'; |
21 |
| - const fixtures = '.class, [type="text"], [class*="lorem-1 lorem-2"], [id^="myID"] { color:red; }'; |
22 |
| - t.is(processing(fixtures, {prefix: 'test-'}), expected); |
| 20 | + const expected = '.class, [type="test-text"], [class*="test-lorem-1 test-lorem-2"], [id^="test-myID"] { color:red; }'; |
| 21 | + const fixtures = '.class, [type="text"], [class*="lorem-1 lorem-2"], [id^="myID"] { color:red; }'; |
| 22 | + t.is(processing(fixtures, {prefix: 'test-'}), expected); |
23 | 23 | });
|
24 | 24 |
|
25 | 25 | test('processing options prefix and attribute selector', t => {
|
26 |
| - const expected = '.class, [type="test-text"] { color:red; }'; |
27 |
| - const fixtures = '.class, [type="text"] { color:red; }'; |
28 |
| - t.is(processing(fixtures, {prefix: 'test-'}), expected); |
| 26 | + const expected = '.class, [type="test-text"] { color:red; }'; |
| 27 | + const fixtures = '.class, [type="text"] { color:red; }'; |
| 28 | + t.is(processing(fixtures, {prefix: 'test-'}), expected); |
29 | 29 | });
|
30 | 30 |
|
31 | 31 | test('processing options prefix, filter and attribute selector', t => {
|
32 |
| - const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; |
33 |
| - const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
34 |
| - t.is(processing(fixtures, { |
35 |
| - prefix: 'test-', |
36 |
| - filter: ['class'] |
37 |
| - }), expected); |
| 32 | + const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; |
| 33 | + const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 34 | + t.is(processing(fixtures, { |
| 35 | + prefix: 'test-', |
| 36 | + filter: ['class'] |
| 37 | + }), expected); |
38 | 38 | });
|
39 | 39 |
|
40 | 40 | test('processing options prefix, filter and attribute selector witch indentical class filter', t => {
|
41 |
| - const expected = '.class, [type="text"], [alt*="class"] { color:red; }'; |
42 |
| - const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }'; |
43 |
| - t.is(processing(fixtures, { |
44 |
| - prefix: 'test-', |
45 |
| - filter: ['class'] |
46 |
| - }), expected); |
| 41 | + const expected = '.class, [type="text"], [alt*="class"] { color:red; }'; |
| 42 | + const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }'; |
| 43 | + t.is(processing(fixtures, { |
| 44 | + prefix: 'test-', |
| 45 | + filter: ['class'] |
| 46 | + }), expected); |
47 | 47 | });
|
48 | 48 |
|
49 | 49 | test('processing options filter and attribute selector', t => {
|
50 |
| - const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
51 |
| - const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
52 |
| - t.is(processing(fixtures, { |
53 |
| - filter: ['class'] |
54 |
| - }), expected); |
| 50 | + const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 51 | + const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 52 | + t.is(processing(fixtures, { |
| 53 | + filter: ['class'] |
| 54 | + }), expected); |
55 | 55 | });
|
56 | 56 |
|
57 | 57 | test('processing options prefix, filter, ignore and attribute selector', t => {
|
58 |
| - const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
59 |
| - const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
60 |
| - t.is(processing(fixtures, { |
61 |
| - prefix: 'test', |
62 |
| - filter: ['class'], |
63 |
| - ignore: ['class'] |
64 |
| - }), expected); |
| 58 | + const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 59 | + const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 60 | + t.is(processing(fixtures, { |
| 61 | + prefix: 'test', |
| 62 | + filter: ['class'], |
| 63 | + ignore: ['class'] |
| 64 | + }), expected); |
65 | 65 | });
|
66 | 66 |
|
67 | 67 | test('processing options prefix, ignore and attribute selector', t => {
|
68 |
| - const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; |
69 |
| - const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
70 |
| - t.is(processing(fixtures, { |
71 |
| - prefix: 'test-', |
72 |
| - ignore: ['type'] |
73 |
| - }), expected); |
| 68 | + const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; |
| 69 | + const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; |
| 70 | + t.is(processing(fixtures, { |
| 71 | + prefix: 'test-', |
| 72 | + ignore: ['type'] |
| 73 | + }), expected); |
74 | 74 | });
|
0 commit comments