Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
 - This WPT test may be referenced by the following Test IDs:
            
- /css/css-anchor-position/container-queries/at-container-anchored-serialization.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<title>CSS Container Queries: anchored() conditionText serialization</title>
<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 anchored(        fallback:--foo) { }
  @container ANChoreD(fallback:    ) { }
  @container anchoRed(fallback) { }
  @container  anchored(  ( fallback: flip-INLINE) OR ( FALLBACK : --bar  ) ) { }
  @container anchored (fallback: top right) { }
</style>
<script>
  setup(() => {
    assert_equals(testSheet.sheet.cssRules.length, 5);
  });
  const tests = [
      ["anchored(fallback: --foo)", "Normalize spaces"],
      ["ANChoreD(fallback:    )", "No value - invalid, serializes as <general-enclosed>"],
      ["anchored(fallback)", "Boolean context"],
      ["anchored((fallback: flip-inline) or (fallback: --bar))", "Logical with 'or'"],
      ["anchored (fallback: top right)", "Not an anchored() 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>