-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathoverriding.test.ts
43 lines (34 loc) · 1.37 KB
/
overriding.test.ts
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
37
38
39
40
41
42
43
import postcss from 'postcss';
import postcssRTLCSS from '../src';
import { PluginOptions } from '../src/@types';
import {
readCSSFile,
runTests,
createSnapshotFileName
} from './utils';
import 'jest-specific-snapshot';
const BASE_NAME = 'overriding';
runTests({}, (pluginOptions: PluginOptions): void => {
describe(`[[Mode: ${pluginOptions.mode}]] Overriding Tests: `, (): void => {
let input = '';
beforeEach(async (): Promise<void> => {
input = input || await readCSSFile('overriding.css');
});
it('Basic', (): void => {
const options: PluginOptions = { ...pluginOptions };
const output = postcss([postcssRTLCSS(options)]).process(input);
expect(output.css).toMatchSpecificSnapshot(
createSnapshotFileName(BASE_NAME,'basic', pluginOptions.mode)
);
expect(output.warnings()).toHaveLength(0);
});
it('With safeBothPrefix', (): void => {
const options: PluginOptions = { ...pluginOptions, safeBothPrefix: true };
const output = postcss([postcssRTLCSS(options)]).process(input);
expect(output.css).toMatchSpecificSnapshot(
createSnapshotFileName(BASE_NAME,'with-safe-both-prefix', pluginOptions.mode)
);
expect(output.warnings()).toHaveLength(0);
});
});
});