| <!DOCTYPE html> |
| <title>CSS Container Queries: scroll-state(scrolled) conditionText serialization</title> |
| <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-queries"> |
| <link rel="help" href="https://drafts.csswg.org/cssom/#serialize-a-css-rule"> |
| <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#scrolled"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script> |
| <style id="testSheet"> |
| @container scroll-state( scrolled:top ) { } |
| @container scroll-STate(scrolled: ) { } |
| @container scroll-STate(scrolled) { } |
| @container scroll-state( ( scrolled: LEFT) OR ( scrolled: BOTTOM ) ) { } |
| @container scroll-state (scrolled: right) { } |
| </style> |
| <script> |
| setup(() => { |
| assert_implements_scroll_state_container_queries(); |
| assert_equals(testSheet.sheet.cssRules.length, 5); |
| }); |
| |
| const tests = [ |
| ["scroll-state(scrolled: top)", "Normalize spaces"], |
| ["scroll-STate(scrolled: )", "No value - invalid, serializes as <general-enclosed>"], |
| ["scroll-state(scrolled)", "Boolean context"], |
| ["scroll-state((scrolled: left) or (scrolled: bottom))", "Logical with 'or'"], |
| ["scroll-state (scrolled: right)", "Not a scroll-state function with space before '('"] |
| ].map((e, i) => [testSheet.sheet.cssRules[i], ...e]); |
| |
| tests.forEach((t) => { |
| test(() => assert_equals(t[0].conditionText, t[1]), t[2]); |
| }); |
| </script> |