|
1 | | -import postcss from 'postcss'; |
2 | | -import test from 'ava'; |
| 1 | +import postcss from 'postcss' |
| 2 | +import test from 'ava' |
3 | 3 |
|
4 | | -import plugin from './'; |
| 4 | +import plugin from './' |
5 | 5 |
|
6 | | -function run(t, input, output, opts = { }) { |
7 | | - return postcss([ plugin(opts) ]).process(input) |
8 | | - .then( result => { |
9 | | - t.deepEqual(result.css, output); |
10 | | - t.deepEqual(result.warnings().length, 0); |
11 | | - }); |
| 6 | +function run (t, input, output, opts = { }) { //eslint-disable-line |
| 7 | + return postcss([plugin(opts)]).process(input) |
| 8 | + .then(function (result) { |
| 9 | + t.deepEqual(result.css, output) |
| 10 | + t.deepEqual(result.warnings().length, 0) |
| 11 | + }) |
12 | 12 | } |
13 | 13 |
|
| 14 | +test('replace overflow-wrap with word-wrap, no options', function (t) { |
| 15 | + return run(t, |
| 16 | + '.someClass{ overflow-wrap: break-word; }', |
| 17 | + '.someClass{ word-wrap: break-word; }' |
| 18 | + , {}) |
| 19 | +}) |
14 | 20 |
|
15 | | -test('replace overflow-wrap with word-wrap, no options', t => { |
16 | | - return run(t, |
17 | | - '.someClass{ overflow-wrap: break-word; }', |
18 | | - '.someClass{ word-wrap: break-word; }' |
19 | | - , {}); |
20 | | -}); |
| 21 | +test('add word-wrap right before overflow-wrap due to passed arg', function (t) { |
| 22 | + return run(t, |
| 23 | + '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', |
| 24 | + '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' |
| 25 | + , { method: 'copy' }) |
| 26 | +}) |
21 | 27 |
|
22 | | -test('add word-wrap right before overflow-wrap due to passed arg', t => { |
23 | | - return run(t, |
24 | | - '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', |
25 | | - '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' |
26 | | - , { method: 'copy' }); |
27 | | -}); |
28 | | - |
29 | | -test('replace overflow-wrap with word-wrap, replace method', t => { |
30 | | - return run(t, |
31 | | - 'main { overflow-wrap: normal; }', |
32 | | - 'main { word-wrap: normal; }' |
33 | | - , { method: 'replace' }); |
34 | | -}); |
| 28 | +test('replace overflow-wrap with word-wrap, replace method', function (t) { |
| 29 | + return run(t, |
| 30 | + 'main { overflow-wrap: normal; }', |
| 31 | + 'main { word-wrap: normal; }' |
| 32 | + , { method: 'replace' }) |
| 33 | +}) |
0 commit comments