Update web-platform-tests to revision b'a6e9e432ca1b26cdf30b08f9de038b85a215361d'

This commit is contained in:
WPT Sync Bot 2022-11-12 01:30:49 +00:00
parent 3cd030566e
commit 1c047e9418
139 changed files with 2729 additions and 938 deletions

View file

@ -7,6 +7,11 @@
<script src="/css/support/parsing-testcommon.js"></script>
<script>
const anchorNames = [
'',
'--foo',
];
const insetProperties = [
'left',
'right',
@ -36,6 +41,7 @@ const fallbacks = [
'1px',
'50%',
'calc(1px + 50%)',
'anchor(left)',
'anchor(--bar left)',
'anchor(--bar left, anchor(--baz right))',
];
@ -44,10 +50,12 @@ const fallbacks = [
for (let property of insetProperties) {
// Using a wrong anchor-side (e.g., `top: anchor(--foo left)`) doesn't cause a
// parse error, but triggers the fallback when resolved.
for (let side of anchorSides) {
for (let fallback of fallbacks) {
let value = `anchor(--foo ${side}${fallback ? ', ' + fallback : ''})`;
test_valid_value(property, value);
for (let name of anchorNames) {
for (let side of anchorSides) {
for (let fallback of fallbacks) {
let value = `anchor(${name ? name + ' ' : ''}${side}${fallback ? ', ' + fallback : ''})`;
test_valid_value(property, value);
}
}
}
}

View file

@ -7,6 +7,11 @@
<script src="/css/support/parsing-testcommon.js"></script>
<script>
const anchorNames = [
'--foo',
'',
];
const sizeProperties = [
'width',
'min-width',
@ -36,16 +41,19 @@ const fallbacks = [
'1px',
'50%',
'calc(1px + 50%)',
'anchor-size(block)',
'anchor-size(--bar block)',
'anchor-size(--bar block, anchor-size(--baz inline))',
];
// Tests basic combinations
for (let property of sizeProperties) {
for (let size of anchorSizes) {
for (let fallback of fallbacks) {
let value = `anchor-size(--foo ${size}${fallback ? ', ' + fallback : ''})`;
test_valid_value(property, value);
for (let name of anchorNames) {
for (let property of sizeProperties) {
for (let size of anchorSizes) {
for (let fallback of fallbacks) {
let value = `anchor-size(${name ? name + ' ' : ''}${size}${fallback ? ', ' + fallback : ''})`;
test_valid_value(property, value);
}
}
}
}

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: Dynamically change position via position-fallback property</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body { margin: 0; }
@position-fallback --fallback1 {
@try {
left: anchor(--a1 right);
}
}
#anchor {
anchor-name: --a1;
width: 100px;
height: 100px;
}
#anchored {
position: absolute;
width: 100px;
height: 100px;
}
</style>
<div id="anchor"></div>
<div id="anchored"></div>
<script>
test(() => {
assert_equals(anchored.offsetLeft, 0);
}, "Initial static left position is 0");
test(() => {
anchored.style.positionFallback = "--fallback1";
assert_equals(anchored.offsetLeft, 100);
}, "Left position set to right edge of anchor with @position-fallback");
</script>