mirror of
https://github.com/servo/servo.git
synced 2025-08-27 16:18:21 +01:00
Update web-platform-tests to revision b'5656a2f4653b5894c500b724778009ca9a26e48c'
This commit is contained in:
parent
cc6026d81e
commit
41d386c907
861 changed files with 3963 additions and 1531 deletions
|
@ -109,6 +109,29 @@ test_template(document.currentScript.previousElementSibling, (t) => {
|
|||
}, 'ex units respond to changes');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<style>
|
||||
:root { font-size: 10px; }
|
||||
:root.larger { font-size: 20px; }
|
||||
@container (width <= 12rex) {
|
||||
#test { color: green }
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<div>
|
||||
<div id="test"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
test_template(document.currentScript.previousElementSibling, (t) => {
|
||||
t.add_cleanup(() => document.documentElement.classList.remove("larger"));
|
||||
assert_equals(getComputedStyle(main.querySelector("#test")).color, red);
|
||||
document.documentElement.classList.add("larger");
|
||||
assert_equals(getComputedStyle(main.querySelector("#test")).color, green);
|
||||
}, 'rex units respond to changes');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<style>
|
||||
main { font-size: 10px; }
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
container-type: inline-size;
|
||||
font-size: 50px;
|
||||
width: 10ex;
|
||||
height: 50rex;
|
||||
}
|
||||
#ch_container {
|
||||
container-type: inline-size;
|
||||
|
@ -40,6 +41,9 @@
|
|||
@container (width: 10ex) {
|
||||
#ex_test { color: green }
|
||||
}
|
||||
@container (49rex <= width <= 100rex) {
|
||||
#rex_test { color: green }
|
||||
}
|
||||
@container (width: 10ch) {
|
||||
#ch_test { color: green }
|
||||
}
|
||||
|
@ -56,6 +60,7 @@
|
|||
</div>
|
||||
<div id="ex_container">
|
||||
<div id="ex_test"></div>
|
||||
<div id="rex_test"></div>
|
||||
</div>
|
||||
<div id="ch_container">
|
||||
<div id="ch_test"></div>
|
||||
|
@ -73,6 +78,7 @@
|
|||
test(() => assert_equals(getComputedStyle(em_test).color, green), "em relative inline-size");
|
||||
test(() => assert_equals(getComputedStyle(rem_test).color, green), "rem relative inline-size");
|
||||
test(() => assert_equals(getComputedStyle(ex_test).color, green), "ex relative inline-size");
|
||||
test(() => assert_equals(getComputedStyle(rex_test).color, green), "rex relative inline-size" + getComputedStyle(ex_container).width + getComputedStyle(ex_container).height);
|
||||
test(() => assert_equals(getComputedStyle(ch_test).color, green), "ch relative inline-size");
|
||||
test(() => assert_equals(getComputedStyle(ic_test).color, green), "ic relative inline-size");
|
||||
test(() => assert_equals(getComputedStyle(lh_test).color, green), "lh relative inline-size");
|
||||
|
|
|
@ -60,7 +60,8 @@
|
|||
test(() => {
|
||||
assert_equals(getComputedStyle(outer, "::first-letter").color, green);
|
||||
}, "Originating element container for outer ::first-letter");
|
||||
test(() => {
|
||||
test((t) => {
|
||||
t.add_cleanup(() => dialog.close());
|
||||
assert_equals(getComputedStyle(dialog, "::backdrop").backgroundColor, lime, "::backdrop not rendered");
|
||||
dialog.showModal();
|
||||
assert_equals(getComputedStyle(dialog, "::backdrop").backgroundColor, green, "::backdrop rendered");
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<title>@container: originating element container for pseudo elements</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/cq-testcommon.js"></script>
|
||||
<style>
|
||||
.container { container-type: inline-size; }
|
||||
#target { display: list-item; }
|
||||
@container (max-width: 200px) {
|
||||
#target::before { content: "PASS"; font-size: 10cqw; }
|
||||
#target::after { font-size: 10cqw; }
|
||||
#target::marker { font-size: 10cqw; }
|
||||
#target::first-line { font-size: 10cqw; }
|
||||
#target::first-letter { font-size: 10cqw; }
|
||||
}
|
||||
@container ((min-width: 300px) and (max-width: 350px)) {
|
||||
#outer::first-line { font-size: 10cqw; }
|
||||
#outer::first-letter { font-size: 10cqw; }
|
||||
}
|
||||
dialog::backdrop { font-size: 0px; }
|
||||
@container (max-width: 100px) {
|
||||
dialog::backdrop { font-size: 10cqw; }
|
||||
}
|
||||
</style>
|
||||
<div style="width: 400px" class="container">
|
||||
<div style="width: 300px" class="container">
|
||||
<div id="target" class="container" style="width: 200px">First-line</div>
|
||||
<dialog id="dialog" class="container" style="width: 100px"></dialog>
|
||||
</div>
|
||||
<div style="width: 400px" class="container">
|
||||
<div id="outer" style="width: 300px" class="container">
|
||||
<div class="container" style="width: 200px">First-line</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
setup(() => assert_implements_container_queries());
|
||||
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, "::before").fontSize, "20px");
|
||||
}, "Originating element container for ::before");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, "::after").fontSize, "20px");
|
||||
}, "Originating element container for ::after");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, "::marker").fontSize, "20px");
|
||||
}, "Originating element container for ::marker");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, "::first-line").fontSize, "20px");
|
||||
}, "Originating element container for ::first-line");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, "::first-letter").fontSize, "20px");
|
||||
}, "Originating element container for ::first-letter");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(outer, "::first-line").fontSize, "30px");
|
||||
}, "Originating element container for outer ::first-line");
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(outer, "::first-letter").fontSize, "30px");
|
||||
}, "Originating element container for outer ::first-letter");
|
||||
test((t) => {
|
||||
t.add_cleanup(() => dialog.close());
|
||||
assert_equals(getComputedStyle(dialog, "::backdrop").fontSize, "0px", "::backdrop not rendered");
|
||||
dialog.showModal();
|
||||
assert_equals(getComputedStyle(dialog, "::backdrop").fontSize, "10px", "::backdrop rendered");
|
||||
}, "Originating element container for ::backdrop");
|
||||
</script>
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<title>@container: originating element container for pseudo elements</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/cq-testcommon.js"></script>
|
||||
<style>
|
||||
#target { container-type: inline-size; }
|
||||
#target::before,
|
||||
#target::after,
|
||||
#target::marker,
|
||||
#target::first-line,
|
||||
#target::first-letter,
|
||||
#target::backdrop {
|
||||
font-size: 0px;
|
||||
}
|
||||
@container (width >= 300px) {
|
||||
#target::before,
|
||||
#target::after,
|
||||
#target::marker,
|
||||
#target::first-line,
|
||||
#target::first-letter,
|
||||
#target::backdrop {
|
||||
font-size: 10cqw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div id="outer" style="width: 200px">
|
||||
<div id="target"></div>
|
||||
</div>
|
||||
<script>
|
||||
setup(() => assert_implements_container_queries());
|
||||
|
||||
const pseudo_elements = ["::before", "::after", "::marker", "::first-line", "::first-letter", "::backdrop"];
|
||||
|
||||
pseudo_elements.forEach((pseudo_element) => {
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, pseudo_element).fontSize, "0px");
|
||||
}, `Initial font-size for ${pseudo_element}`);
|
||||
});
|
||||
|
||||
outer.style.width = "300px";
|
||||
|
||||
pseudo_elements.forEach((pseudo_element) => {
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(target, pseudo_element).fontSize, "30px");
|
||||
}, `font-size for ${pseudo_element} depending on container`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue