@@ -6,7 +6,7 @@ test("hello world", () => {
66 color: red;
77}` ) ;
88
9- expect ( compiled ) . toStrictEqual ( {
9+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
1010 s : [
1111 [
1212 "my-class" ,
@@ -34,8 +34,8 @@ test("reads global CSS variables", () => {
3434 }
3535}` ) ;
3636
37- expect ( compiled ) . toStrictEqual ( {
38- vr : [ [ "color-red-500" , [ "#fb2c36" ] ] ] ,
37+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
38+ vr : [ [ "color-red-500" , [ [ "#fb2c36" ] ] ] ] ,
3939 } ) ;
4040} ) ;
4141
@@ -49,7 +49,7 @@ test.skip("removes unused CSS variables", () => {
4949 }
5050 ` ) ;
5151
52- expect ( compiled ) . toStrictEqual ( {
52+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
5353 s : [
5454 [
5555 "test" ,
@@ -84,7 +84,7 @@ test.skip("preserves unused CSS variables with preserve-variables", () => {
8484 }
8585 ` ) ;
8686
87- expect ( compiled ) . toStrictEqual ( {
87+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
8888 s : [
8989 [
9090 "test" ,
@@ -117,7 +117,7 @@ test("multiple rules with same selector", () => {
117117}
118118` ) ;
119119
120- expect ( compiled ) . toStrictEqual ( {
120+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
121121 s : [
122122 [
123123 "redOrGreen" ,
@@ -157,7 +157,7 @@ test.skip("transitions", () => {
157157 }
158158 ` ) ;
159159
160- expect ( compiled ) . toStrictEqual ( {
160+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
161161 s : [
162162 [
163163 "test" ,
@@ -195,7 +195,7 @@ test.skip("animations", () => {
195195 }
196196 ` ) ;
197197
198- expect ( compiled ) . toStrictEqual ( {
198+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
199199 k : [
200200 [
201201 "spin" ,
@@ -242,8 +242,8 @@ test("breaks apart comma separated variables", () => {
242242 }
243243 ` ) ;
244244
245- expect ( compiled ) . toStrictEqual ( {
246- vr : [ [ "test" , [ [ "blue" , "green" ] ] ] ] ,
245+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
246+ vr : [ [ "test" , [ [ [ "blue" , "green" ] ] ] ] ] ,
247247 } ) ;
248248} ) ;
249249
@@ -253,7 +253,7 @@ test("light-dark()", () => {
253253 background-color: light-dark(#333b3c, #efefec);
254254}` ) ;
255255
256- expect ( compiled ) . toStrictEqual ( {
256+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
257257 s : [
258258 [
259259 "my-class" ,
@@ -295,20 +295,17 @@ test("media query nested in rules", () => {
295295
296296 @media (min-width: 100px) {
297297 background-color: yellow;
298+
298299 }
299300}` ) ;
300301
301- expect ( compiled ) . toStrictEqual ( {
302+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
302303 s : [
303304 [
304305 "my-class" ,
305306 [
306307 {
307- d : [
308- {
309- color : "#f00" ,
310- } ,
311- ] ,
308+ d : [ { color : "#f00" } ] ,
312309 s : [ 1 , 1 ] ,
313310 v : [ [ "__rn-css-color" , "#f00" ] ] ,
314311 } ,
@@ -323,51 +320,43 @@ test("media query nested in rules", () => {
323320 v : [ [ "__rn-css-color" , "#00f" ] ] ,
324321 } ,
325322 {
326- d : [
327- {
328- backgroundColor : "#008000" ,
329- } ,
323+ d : [ { backgroundColor : "#008000" } ] ,
324+ m : [
325+ [ ">=" , "width" , 600 ] ,
326+ [ ">=" , "width" , 400 ] ,
330327 ] ,
331- m : [ [ ">=" , "width" , 400 ] ] ,
332328 s : [ 3 , 1 ] ,
333329 } ,
334330 {
335- d : [
336- {
337- backgroundColor : "#ff0" ,
338- } ,
339- ] ,
331+ d : [ { backgroundColor : "#ff0" } ] ,
340332 m : [ [ ">=" , "width" , 100 ] ] ,
341333 s : [ 4 , 1 ] ,
342334 } ,
335+ ] ,
336+ ] ,
337+ ] ,
338+ } ) ;
339+ } ) ;
340+
341+ test ( "container queries" , ( ) => {
342+ const compiled = compile ( `
343+ @container (width > 400px) {
344+ .child {
345+ color: blue;
346+ }
347+ }` ) ;
348+
349+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
350+ s : [
351+ [
352+ "child" ,
353+ [
343354 {
344- d : [
345- {
346- color : "#00f" ,
347- } ,
348- ] ,
349- m : [ [ ">=" , "width" , 600 ] ] ,
350- s : [ 2 , 1 , 1 ] ,
355+ cq : [ { m : [ ">" , "width" , 400 ] } ] ,
356+ d : [ { color : "#00f" } ] ,
357+ s : [ 2 , 1 ] ,
351358 v : [ [ "__rn-css-color" , "#00f" ] ] ,
352359 } ,
353- {
354- d : [
355- {
356- backgroundColor : "#008000" ,
357- } ,
358- ] ,
359- m : [ [ ">=" , "width" , 400 ] ] ,
360- s : [ 3 , 1 , 1 ] ,
361- } ,
362- {
363- d : [
364- {
365- backgroundColor : "#ff0" ,
366- } ,
367- ] ,
368- m : [ [ ">=" , "width" , 100 ] ] ,
369- s : [ 4 , 1 , 1 ] ,
370- } ,
371360 ] ,
372361 ] ,
373362 ] ,
0 commit comments