Skip to content

Commit 7152a5d

Browse files
committed
Split empty rules test snapshot into multiple files
1 parent e21d6bb commit 7152a5d

File tree

5 files changed

+75
-64
lines changed

5 files changed

+75
-64
lines changed

tests/__snapshots__/empty-rules.test.ts.snap

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`[[Mode: combined]] Empty Rules Tests: Basic 1`] = `
4+
".test1 {}
5+
6+
.test2, .test3 {}
7+
8+
[dir="ltr"] .test4 {
9+
text-align: left;
10+
}
11+
12+
[dir="rtl"] .test4 {
13+
text-align: right;
14+
}
15+
16+
.test5 {
17+
color: red;
18+
}
19+
20+
[dir="ltr"] .test5 {
21+
padding-left: 20px;
22+
}
23+
24+
[dir="rtl"] .test5 {
25+
padding-right: 20px;
26+
}"
27+
`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`[[Mode: diff]] Empty Rules Tests: Basic 1`] = `
4+
".test4 {
5+
text-align: right;
6+
}
7+
8+
.test5 {
9+
padding-left: 0;
10+
padding-right: 20px;
11+
}"
12+
`;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`[[Mode: override]] Empty Rules Tests: Basic 1`] = `
4+
".test1 {}
5+
6+
.test2, .test3 {}
7+
8+
.test4 {
9+
text-align: left;
10+
}
11+
12+
[dir="rtl"] .test4 {
13+
text-align: right;
14+
}
15+
16+
.test5 {
17+
color: red;
18+
padding-left: 20px;
19+
}
20+
21+
[dir="rtl"] .test5 {
22+
padding-left: 0;
23+
padding-right: 20px;
24+
}"
25+
`;

tests/empty-rules.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import postcss from 'postcss';
22
import postcssRTLCSS from '../src';
33
import { PluginOptions } from '../src/@types';
4-
import { readCSSFile, runTests } from './utils';
4+
import {
5+
readCSSFile,
6+
runTests,
7+
createSnapshotFileName
8+
} from './utils';
9+
import 'jest-specific-snapshot';
10+
11+
const BASE_NAME = 'empty-rules';
512

613
runTests({}, (pluginOptions: PluginOptions): void => {
714
describe(`[[Mode: ${pluginOptions.mode}]] Empty Rules Tests: `, () => {
@@ -14,7 +21,9 @@ runTests({}, (pluginOptions: PluginOptions): void => {
1421
it('Basic', (): void => {
1522
const options: PluginOptions = { ...pluginOptions };
1623
const output = postcss([postcssRTLCSS(options)]).process(input);
17-
expect(output.css).toMatchSnapshot();
24+
expect(output.css).toMatchSpecificSnapshot(
25+
createSnapshotFileName(BASE_NAME,'basic', pluginOptions.mode)
26+
);
1827
expect(output.warnings()).toHaveLength(0);
1928
});
2029
});

0 commit comments

Comments
 (0)