commit 57d3ff4e0713684663d8002b8b902a8aba4f74a0
parent a1b7dfd249667d1aa5b183523fc5cc28f1a6a2b9
Author: Jonathan Kew <jkew@mozilla.com>
Date: Fri, 19 Dec 2025 09:47:36 +0000
Bug 2006366 - Adjust WPT anchor-parse-valid.html to accept simplification of min(x%, y%) function within anchor(). r=layout-reviewers,layout-anchor-positioning-reviewers,dshin,dholbert
Min() or max() functions used in anchor() can be simplified, given that the
percentage basis is a size that cannot be negative.
In such cases, Firefox does the simplification, so that min(50%, 100%) gets
serialized as calc(50%).
This just modifies the test to expect either the originally-specified or the
simplified form in the affected cases.
(See also https://github.com/w3c/csswg-drafts/issues/12131.)
Differential Revision: https://phabricator.services.mozilla.com/D277113
Diffstat:
2 files changed, 13 insertions(+), 509 deletions(-)
diff --git a/testing/web-platform/meta/css/css-anchor-position/anchor-parse-valid.html.ini b/testing/web-platform/meta/css/css-anchor-position/anchor-parse-valid.html.ini
@@ -1,504 +0,0 @@
-[anchor-parse-valid.html]
- [e.style['left'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['left'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['right'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['top'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['bottom'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-start'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-block-end'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-start'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, 1px)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, 50%)" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, calc(50% + 1px))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, anchor(left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(--foo min(50%, 100%), anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
-
- [e.style['inset-inline-end'\] = "anchor(min(50%, 100%) --foo, anchor(--bar left, anchor(--baz right)))" should set the property value]
- expected: FAIL
diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-parse-valid.html b/testing/web-platform/tests/css/css-anchor-position/anchor-parse-valid.html
@@ -37,7 +37,10 @@ const anchorSides = [
'center',
'50%',
'calc(50%)',
- 'min(50%, 100%)',
+ // Array entry in the test list: the first value is the value to be specified;
+ // subsequent values are alternative serializations that will also be accepted
+ // when checking that the value was set.
+ ['min(50%, 100%)', 'calc(50%)'],
];
const fallbacks = [
@@ -56,13 +59,18 @@ for (let property of insetProperties) {
// parse error, but triggers the fallback when resolved.
for (let name of anchorNames) {
for (let side of anchorSides) {
+ // 'side' is either a single value, or an array with a value followed by allowable simplifications.
+ let anchorSide = Array.isArray(side) ? side[0] : side;
for (let fallback of fallbacks) {
- let value = `anchor(${name ? name + ' ' : ''}${side}${fallback ? ', ' + fallback : ''})`;
- test_valid_value(property, value);
+ let value = `anchor(${name ? name + ' ' : ''}${anchorSide}${fallback ? ', ' + fallback : ''})`;
+ let expect = Array.isArray(side)
+ ? side.map((s) => `anchor(${name ? name + ' ' : ''}${s}${fallback ? ', ' + fallback : ''})`)
+ : value;
+ test_valid_value(property, value, expect);
if (name) {
// The <anchor-element> is allowed to appear after the <anchor-side>
- let value_flip_order = `anchor(${side} ${name}${fallback ? ', ' + fallback : ''})`;
- test_valid_value(property, value_flip_order, value);
+ let value_flip_order = `anchor(${anchorSide} ${name}${fallback ? ', ' + fallback : ''})`;
+ test_valid_value(property, value_flip_order, expect);
}
}
}