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.deepEqual(result.css, output);
            t.deepEqual(result.warnings().length, 0);
        });
}


test('replace overflow-wrap with word-wrap, no options', t => {
    return run(t,
        '.someClass{ overflow-wrap: break-word; }',
        '.someClass{ word-wrap: break-word; }'
    , {});
});

test('add word-wrap right before overflow-wrap due to passed arg', t => {
    return run(t,
        '.anotherClass{font-size:1rem;overflow-wrap:break-word;}',
        '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}'
    , { method: 'copy' });
});

@@ -783,16 +783,218 @@
  'copy' %7D);%0A%7D);%0A
+%0Atest('replace overflow-wrap with word-wrap, replace method', t =%3E %7B%0A    return run(t,%0A        'main %7B overflow-wrap: normal; %7D',%0A        'main %7B word-wrap: normal; %7D'%0A    , %7B method: 'replace' %7D);%0A%7D);%0A

add test