at-container-anchored-serialization.html (1396B)
1 <!DOCTYPE html> 2 <title>CSS Container Queries: anchored() conditionText serialization</title> 3 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-2/#anchored-container-queries"> 4 <link rel="help" href="https://drafts.csswg.org/cssom/#serialize-a-css-rule"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script> 8 <style id="testSheet"> 9 @container anchored( fallback:--foo) { } 10 @container ANChoreD(fallback: ) { } 11 @container anchoRed(fallback) { } 12 @container anchored( ( fallback: flip-INLINE) OR ( FALLBACK : --bar ) ) { } 13 @container anchored (fallback: top right) { } 14 </style> 15 <script> 16 setup(() => { 17 assert_equals(testSheet.sheet.cssRules.length, 5); 18 }); 19 20 const tests = [ 21 ["anchored(fallback: --foo)", "Normalize spaces"], 22 ["ANChoreD(fallback: )", "No value - invalid, serializes as <general-enclosed>"], 23 ["anchored(fallback)", "Boolean context"], 24 ["anchored((fallback: flip-inline) or (fallback: --bar))", "Logical with 'or'"], 25 ["anchored (fallback: top right)", "Not an anchored() function with space before '('"] 26 ].map((e, i) => [testSheet.sheet.cssRules[i], ...e]); 27 28 tests.forEach((t) => { 29 test(() => assert_equals(t[0].conditionText, t[1]), t[2]); 30 }); 31 </script>