Update web-platform-tests to revision b'89142292ab8c7f3564d978a76fdabc66626c421e'

This commit is contained in:
WPT Sync Bot 2023-01-26 01:42:16 +00:00
parent 7f838a4f5f
commit cda7a10498
98 changed files with 2782 additions and 1163 deletions

View file

@ -0,0 +1,78 @@
<!DOCTYPE html>
<title>Tests CSS transition of anchor() and anchor-size() functions</title>
<link rel="help" href="https://drafts4.csswg.org/css-anchor-1/">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/8180"></script>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
margin: 0;
}
#anchor1 {
margin-left: 0px;
margin-top: 0px;
width: 200px;
height: 100px;
background: orange;
anchor-name: --a1;
}
#anchor2 {
margin-left: 400px;
margin-top: 200px;
width: 100px;
height: 200px;
background: orange;
anchor-name: --a2;
}
#target {
position: fixed;
width: 100px;
height: 100px;
background-color: lime;
transition: all 10s -5s linear;
}
#target.before {
top: anchor(--a1 top);
left: anchor(--a1 right);
width: anchor-size(--a1 width);
height: anchor-size(--a1 height);
}
#target.after {
top: anchor(--a2 bottom);
left: anchor(--a2 left);
width: anchor-size(--a2 width);
height: anchor-size(--a2 height);
}
</style>
<div id="anchor1"></div>
<div id="anchor2"></div>
<div id="target" class="before"></div>
<script>
setup(() => {
// Forces layout
target.offsetLeft;
// Triggers transition starting at 50% immediately
target.classList.remove('before');
target.classList.add('after');
});
test(() => {
assert_equals(target.offsetLeft, 300);
assert_equals(target.offsetTop, 250);
}, 'Transition of anchor() when changing target anchor element name');
test(() => {
assert_equals(target.offsetWidth, 150);
assert_equals(target.offsetHeight, 150);
}, 'Transition of anchor-size() when changing target anchor element name');
</script>

View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<title>Tests CSS transition of anchor() across tree scopes</title>
<link rel="help" href="https://drafts4.csswg.org/css-anchor-1/">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/8180"></script>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
margin: 0;
}
#anchor1 {
width: 100px;
height: 100px;
background: orange;
anchor-name: --a;
}
#anchor2 {
width: 100px;
height: 100px;
margin-top: 200px;
margin-left: 300px;
background: orange;
}
#anchor2.after::part(target) {
top: anchor(--a top);
left: anchor(--a right);
}
</style>
<div id="anchor1"></div>
<div id="anchor2"></div>
<script>
setup(() => {
let shadow = anchor2.attachShadow({mode: 'open'});
shadow.innerHTML = `
<style>
:host { anchor-name: --a; }
#target {
position: fixed;
width: 100px;
height: 100px;
background: lime;
top: anchor(--a top);
left: anchor(--a right);
transition: all 10s -5s linear;
}
</style>
<div id="target" part="target"></div>
`;
});
test(() => {
let target = anchor2.shadowRoot.getElementById('target');
// Forces layout
target.offsetLeft;
// Triggers a transition from using #anchor2 to using #anchor1,
// starting immediately at 50% progress.
anchor2.classList.add('after');
assert_equals(target.offsetLeft, 250);
assert_equals(target.offsetTop, 150);
}, 'Transition with anchor names defined in different tree scopes');
</script>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<title>Tests CSS transition of anchor() across three tree scopes</title>
<link rel="help" href="https://drafts4.csswg.org/css-anchor-1/">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/8180"></script>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
margin: 0;
}
#anchor1 {
width: 100px;
height: 100px;
background: orange;
anchor-name: --a;
}
#host.after::part(target) {
left: anchor(--a left);
}
</style>
<div id="anchor1"></div>
<div id="host"></div>
<script>
setup(() => {
let shadow = host.attachShadow({mode: 'open'});
shadow.innerHTML = `
<style>
div {
width: 100px;
height: 100px;
background: orange;
}
#anchor2 {
margin-left: 200px;
anchor-name: --a;
}
#anchor3 {
margin-left: 400px;
}
#target {
position: fixed;
background: lime;
top: 300px;
transition: left 10s -5s linear;
}
#target.after {
left: anchor(--a left);
}
</style>
<div id="anchor2"></div>
<div id="anchor3">
<div id="target" part="target"></div>
</div>
`;
let anchor3 = shadow.getElementById('anchor3');
let innerShadow = anchor3.attachShadow({mode: 'open'});
innerShadow.innerHTML = `
<style>
:host { anchor-name: --a; }
::slotted(*) { left: anchor(--a left); }
</style>
<slot></slot>
`;
});
test(() => {
let target = host.shadowRoot.getElementById('target');
// Forces layout
target.offsetLeft;
// Triggers a transition from using #anchor3 to using #anchor2,
// starting immediately at 50% progress
target.classList.add('after');
assert_equals(target.offsetLeft, 300);
// Triggers another transition to using #anchor1 while the previous
// transition is still in progress.
host.classList.add('after');
assert_equals(target.offsetLeft, 150);
}, 'Transition with anchor names defined in three different tree scopes');
</script>