@@ -2,78 +2,78 @@ import postcss from 'postcss';
22import postcssRTLCSS from '../src' ;
33import { PluginOptions , Source } from '../src/@types' ;
44import {
5- readCSSFile ,
6- runTests ,
7- createSnapshotFileName
5+ readCSSFile ,
6+ runTests ,
7+ createSnapshotFileName
88} from './utils' ;
99import 'jest-specific-snapshot' ;
1010
1111const BASE_NAME = 'basic-options' ;
1212
1313runTests ( { } , ( pluginOptions : PluginOptions ) : void => {
1414
15- describe ( `[[Mode: ${ pluginOptions . mode } ]] Basic Options Tests: ` , ( ) : void => {
15+ describe ( `[[Mode: ${ pluginOptions . mode } ]] Basic Options Tests: ` , ( ) : void => {
16+
17+ let input = '' ;
18+
19+ beforeEach ( async ( ) : Promise < void > => {
20+ input = input || await readCSSFile ( 'input.css' ) ;
21+ } ) ;
22+
23+ it ( 'Basic' , ( ) : void => {
24+ const options : PluginOptions = { ...pluginOptions } ;
25+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
26+ expect ( output . css ) . toMatchSpecificSnapshot (
27+ createSnapshotFileName ( BASE_NAME , 'basic' , pluginOptions . mode )
28+ ) ;
29+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
30+ } ) ;
31+
32+ it ( '{source: rtl}' , ( ) : void => {
33+ const options : PluginOptions = { ...pluginOptions , source : Source . rtl } ;
34+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
35+ expect ( output . css ) . toMatchSpecificSnapshot (
36+ createSnapshotFileName ( BASE_NAME , 'source-rtl' , pluginOptions . mode )
37+ ) ;
38+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
39+ } ) ;
40+
41+ it ( '{processUrls: true}' , ( ) : void => {
42+ const options : PluginOptions = { ...pluginOptions , processUrls : true } ;
43+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
44+ expect ( output . css ) . toMatchSpecificSnapshot (
45+ createSnapshotFileName ( BASE_NAME , 'process-url-true' , pluginOptions . mode )
46+ ) ;
47+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
48+ } ) ;
49+
50+ it ( '{processKeyFrames: true}' , ( ) : void => {
51+ const options : PluginOptions = { ...pluginOptions , processKeyFrames : true } ;
52+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
53+ expect ( output . css ) . toMatchSpecificSnapshot (
54+ createSnapshotFileName ( BASE_NAME , 'process-keyframes-true' , pluginOptions . mode )
55+ ) ;
56+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
57+ } ) ;
58+
59+ it ( '{source: rtl, processKeyFrames: true}' , ( ) : void => {
60+ const options : PluginOptions = { ...pluginOptions , source : Source . rtl , processKeyFrames : true } ;
61+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
62+ expect ( output . css ) . toMatchSpecificSnapshot (
63+ createSnapshotFileName ( BASE_NAME , 'source-rtl-and-process-keyframes-true' , pluginOptions . mode )
64+ ) ;
65+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
66+ } ) ;
67+
68+ it ( '{useCalc: true}' , ( ) : void => {
69+ const options : PluginOptions = { ...pluginOptions , useCalc : true } ;
70+ const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
71+ expect ( output . css ) . toMatchSpecificSnapshot (
72+ createSnapshotFileName ( BASE_NAME , 'use-calc-true' , pluginOptions . mode )
73+ ) ;
74+ expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
75+ } ) ;
1676
17- let input = '' ;
18-
19- beforeEach ( async ( ) : Promise < void > => {
20- input = input || await readCSSFile ( 'input.css' ) ;
21- } ) ;
22-
23- it ( 'Basic' , ( ) : void => {
24- const options : PluginOptions = { ...pluginOptions } ;
25- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
26- expect ( output . css ) . toMatchSpecificSnapshot (
27- createSnapshotFileName ( BASE_NAME , 'basic' , pluginOptions . mode )
28- ) ;
29- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
30- } ) ;
31-
32- it ( '{source: rtl}' , ( ) : void => {
33- const options : PluginOptions = { ...pluginOptions , source : Source . rtl } ;
34- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
35- expect ( output . css ) . toMatchSpecificSnapshot (
36- createSnapshotFileName ( BASE_NAME , 'source-rtl' , pluginOptions . mode )
37- ) ;
38- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
39- } ) ;
40-
41- it ( '{processUrls: true}' , ( ) : void => {
42- const options : PluginOptions = { ...pluginOptions , processUrls : true } ;
43- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
44- expect ( output . css ) . toMatchSpecificSnapshot (
45- createSnapshotFileName ( BASE_NAME , 'process-url-true' , pluginOptions . mode )
46- ) ;
47- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
48- } ) ;
49-
50- it ( '{processKeyFrames: true}' , ( ) : void => {
51- const options : PluginOptions = { ...pluginOptions , processKeyFrames : true } ;
52- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
53- expect ( output . css ) . toMatchSpecificSnapshot (
54- createSnapshotFileName ( BASE_NAME , 'process-keyframes-true' , pluginOptions . mode )
55- ) ;
56- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
57- } ) ;
58-
59- it ( '{source: rtl, processKeyFrames: true}' , ( ) : void => {
60- const options : PluginOptions = { ...pluginOptions , source : Source . rtl , processKeyFrames : true } ;
61- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
62- expect ( output . css ) . toMatchSpecificSnapshot (
63- createSnapshotFileName ( BASE_NAME , 'source-rtl-and-process-keyframes-true' , pluginOptions . mode )
64- ) ;
65- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
66- } ) ;
67-
68- it ( '{useCalc: true}' , ( ) : void => {
69- const options : PluginOptions = { ...pluginOptions , useCalc : true } ;
70- const output = postcss ( [ postcssRTLCSS ( options ) ] ) . process ( input ) ;
71- expect ( output . css ) . toMatchSpecificSnapshot (
72- createSnapshotFileName ( BASE_NAME , 'use-calc-true' , pluginOptions . mode )
73- ) ;
74- expect ( output . warnings ( ) ) . toHaveLength ( 0 ) ;
7577 } ) ;
76-
77- } ) ;
7878
7979} ) ;
0 commit comments