|
12 | 12 | }
|
13 | 13 | #id { color: green }
|
14 | 14 | }
|
15 |
| - @container ( wiDTh ) { } |
16 |
| - @container (width:100px) { } |
17 |
| - @container (min-width: 100px) { } |
18 |
| - @container ( MAX-WIDTH:100px ) { } |
19 |
| - @container (width > 100px) { } |
20 |
| - @container (width < 100px) { } |
21 |
| - @container (widTH >= 100px) { } |
22 |
| - @container (width <= 100px) { } |
23 |
| - @container (10px < width < 100px) { } |
24 |
| - @container (10px <= width <= 100px) { } |
25 |
| - @container (100px>WIDTH>10px) { } |
26 |
| - @container ( 100px >= width >= 10px ) { } |
27 |
| - @container (calc(1em + 1px) >= width >= max(10em, 10px)) { } |
28 | 15 | </style>
|
| 16 | +<main id="cq-main"></main> |
29 | 17 | <script>
|
30 | 18 | setup(() => assert_implements_size_container_queries());
|
31 | 19 |
|
32 |
| - let rules = testSheet.sheet.cssRules; |
| 20 | + const rules = testSheet.sheet.cssRules; |
33 | 21 |
|
34 | 22 | test(() => {
|
35 |
| - assert_equals(rules.length, 14); |
| 23 | + assert_equals(rules.length, 1); |
36 | 24 | assert_equals(rules[0].cssRules.length, 2);
|
37 | 25 |
|
38 | 26 | assert_equals(rules[0].conditionText, "(width = 100px)");
|
|
47 | 35 | assert_equals(rules[0].cssText, "@container (width = 100px) {\n @container \\!-name (inline-size > 200px) {\n #id { color: lime; }\n}\n #id { color: green; }\n}");
|
48 | 36 | }, "Serialization of nested @container rule");
|
49 | 37 |
|
50 |
| - test(() => { |
51 |
| - assert_equals(rules[1].conditionText, "(width)"); |
52 |
| - }, "Serialization of boolean condition syntax"); |
53 |
| - |
54 |
| - test(() => { |
55 |
| - assert_equals(rules[2].conditionText, "(width: 100px)"); |
56 |
| - assert_equals(rules[3].conditionText, "(min-width: 100px)"); |
57 |
| - assert_equals(rules[4].conditionText, "(max-width: 100px)"); |
58 |
| - }, "Serialization of colon condition syntax"); |
59 |
| - |
60 |
| - test(() => { |
61 |
| - assert_equals(rules[5].conditionText, "(width > 100px)"); |
62 |
| - assert_equals(rules[6].conditionText, "(width < 100px)"); |
63 |
| - assert_equals(rules[7].conditionText, "(width >= 100px)"); |
64 |
| - assert_equals(rules[8].conditionText, "(width <= 100px)"); |
65 |
| - assert_equals(rules[9].conditionText, "(10px < width < 100px)"); |
66 |
| - assert_equals(rules[10].conditionText, "(10px <= width <= 100px)"); |
67 |
| - assert_equals(rules[11].conditionText, "(100px > width > 10px)"); |
68 |
| - assert_equals(rules[12].conditionText, "(100px >= width >= 10px)"); |
69 |
| - }, "Serialization of range condition syntax"); |
70 |
| - |
71 |
| - test(() => { |
72 |
| - assert_equals(rules[13].conditionText, "(calc(1em + 1px) >= width >= max(10em, 10px))"); |
73 |
| - }, "Serialization of calc()"); |
| 38 | + const testCases = [ |
| 39 | + ["( wiDTh )", "(width)"], |
| 40 | + ["(width:100px)", "(width: 100px)"], |
| 41 | + ["(min-width: 100px)", "(min-width: 100px)"], |
| 42 | + ["( MAX-WIDTH:100px )", "(max-width: 100px)"], |
| 43 | + ["(width > 100px)", "(width > 100px)"], |
| 44 | + ["(width < 100px)", "(width < 100px)"], |
| 45 | + ["(widTH >= 100px)", "(width >= 100px)"], |
| 46 | + ["(width <= 100px)", "(width <= 100px)"], |
| 47 | + ["(10px < width < 100px)", "(10px < width < 100px)"], |
| 48 | + ["(10px <= width <= 100px)", "(10px <= width <= 100px)"], |
| 49 | + ["(100px>WIDTH>10px)", "(100px > width > 10px)"], |
| 50 | + ["( 100px >= width >= 10px )", "(100px >= width >= 10px)"], |
| 51 | + ["(calc(1em + 1px) >= width >= max(10em, 10px))", "(calc(1em + 1px) >= width >= max(10em, 10px))"], |
| 52 | + ["(width),(height) ,--foo ,--bar", "(width), (height), --foo, --bar"], |
| 53 | + ]; |
| 54 | + |
| 55 | + for (testCase of testCases) { |
| 56 | + test_cq_condition_serialization(testCase[0], testCase[1]); |
| 57 | + } |
74 | 58 | </script>
|
0 commit comments