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