File tree Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,114 @@ function run(input, opts = config) {
66 return postcss ( [ plugin ( opts ) ] ) . process ( input , { from : undefined } )
77}
88
9+ test ( 'it can generate responsive variants for nested at rules' , ( ) => {
10+ const input = `
11+ @responsive {
12+ .banana { color: yellow; }
13+ .chocolate { color: brown; }
14+
15+ @supports(display: grid) {
16+ .grid\\:banana { color: blue; }
17+ .grid\\:chocolate { color: green; }
18+ }
19+ }
20+ `
21+
22+ const output = `
23+ .banana {
24+ color: yellow;
25+ }
26+
27+ .chocolate {
28+ color: brown;
29+ }
30+
31+ @supports(display: grid) {
32+ .grid\\:banana {
33+ color: blue;
34+ }
35+
36+ .grid\\:chocolate {
37+ color: green;
38+ }
39+ }
40+
41+ @media (min-width: 500px) {
42+ .sm\\:banana {
43+ color: yellow;
44+ }
45+
46+ .sm\\:chocolate {
47+ color: brown;
48+ }
49+
50+ @supports(display: grid) {
51+ .sm\\:grid\\:banana {
52+ color: blue;
53+ }
54+
55+ .sm\\:grid\\:chocolate {
56+ color: green;
57+ }
58+ }
59+ }
60+
61+ @media (min-width: 750px) {
62+ .md\\:banana {
63+ color: yellow;
64+ }
65+
66+ .md\\:chocolate {
67+ color: brown;
68+ }
69+
70+ @supports(display: grid) {
71+ .md\\:grid\\:banana {
72+ color: blue;
73+ }
74+
75+ .md\\:grid\\:chocolate {
76+ color: green;
77+ }
78+ }
79+ }
80+
81+ @media (min-width: 1000px) {
82+ .lg\\:banana {
83+ color: yellow;
84+ }
85+
86+ .lg\\:chocolate {
87+ color: brown;
88+ }
89+
90+ @supports(display: grid) {
91+ .lg\\:grid\\:banana {
92+ color: blue;
93+ }
94+
95+ .lg\\:grid\\:chocolate {
96+ color: green;
97+ }
98+ }
99+ }
100+ `
101+
102+ return run ( input , {
103+ screens : {
104+ sm : '500px' ,
105+ md : '750px' ,
106+ lg : '1000px' ,
107+ } ,
108+ options : {
109+ separator : ':' ,
110+ } ,
111+ } ) . then ( result => {
112+ expect ( result . css ) . toMatchCss ( output )
113+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
114+ } )
115+ } )
116+
9117test ( 'it can generate responsive variants' , ( ) => {
10118 const input = `
11119 @responsive {
You can’t perform that action at this time.
0 commit comments