mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision b'afdce893ed51bc1a7a7ac03b16b5a575caad071a'
This commit is contained in:
parent
a8da28e55d
commit
3b420af385
393 changed files with 17484 additions and 4185 deletions
|
@ -39,6 +39,11 @@
|
|||
test_valid('@scope (.a)to (.b)', '@scope (.a) to (.b)');
|
||||
test_valid('@scope (.a) to (.b:hover, #c, div)');
|
||||
test_valid('@scope');
|
||||
test_valid('@scope (.a) to (&)');
|
||||
test_valid('@scope (.a) to (& > &)');
|
||||
test_valid('@scope (.a) to (> .b)');
|
||||
test_valid('@scope (.a) to (+ .b)');
|
||||
test_valid('@scope (.a) to (~ .b)');
|
||||
|
||||
// Forgiving behavior:
|
||||
test_valid('@scope (.c <> .d)', '@scope ()');
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#target { color: red; }
|
||||
.target { color: red; }
|
||||
</style>
|
||||
<style id="styleElement"></style>
|
||||
<div id="target"></div>
|
||||
<div id="target" class="target"></div>
|
||||
<script>
|
||||
const testCases = [
|
||||
{
|
||||
|
@ -31,14 +30,11 @@
|
|||
matches: false
|
||||
}
|
||||
];
|
||||
|
||||
let styleElement = document.querySelector("#styleElement");
|
||||
|
||||
styleElement.remove();
|
||||
|
||||
let target = document.getElementById("target");
|
||||
for (let testCase of testCases) {
|
||||
promise_test(async t => {
|
||||
styleElement.innerText = "@import url(data:text/css,#target{color:green}) " + testCase.importCondition + ";";
|
||||
let styleElement = document.createElement("style");
|
||||
styleElement.innerText = "@import url(data:text/css,.target{color:green}) " + testCase.importCondition + ";";
|
||||
|
||||
await new Promise(resolve => {
|
||||
styleElement.onload = resolve;
|
||||
|
|
|
@ -391,7 +391,7 @@ test_scope(document.currentScript, () => {
|
|||
|
||||
<template>
|
||||
<style>
|
||||
@scope (.a) to (.a) {
|
||||
@scope (.a) to (:scope) {
|
||||
* { background-color: green; }
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -89,3 +89,23 @@ test((t) => {
|
|||
assert_equals(getComputedStyle(outer).zIndex, 'auto');
|
||||
}, '@scope works with two identical stylesheets');
|
||||
</script>
|
||||
|
||||
|
||||
<template id=test_forgiving>
|
||||
<div>
|
||||
<style>
|
||||
@scope ($invalid) {
|
||||
#a { z-index:1; }
|
||||
}
|
||||
</style>
|
||||
<div id=a></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
test((t) => {
|
||||
t.add_cleanup(() => main.replaceChildren());
|
||||
main.append(test_forgiving.content.cloneNode(true));
|
||||
|
||||
assert_equals(getComputedStyle(a).zIndex, 'auto');
|
||||
}, '@scope with effectively empty :is() must not match anything');
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html>
|
||||
<title>@scope - nesting (&)</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scope-atrule">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-nesting-1/#nest-selector">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<main id=main></main>
|
||||
|
||||
<template id=test_nest_scope_end>
|
||||
<div>
|
||||
<style>
|
||||
@scope (.a) to (& > &) {
|
||||
* { z-index:1; }
|
||||
}
|
||||
</style>
|
||||
<div class=a> <!-- This scope is limited by the element below. -->
|
||||
<div class=a> <!-- This scope is limited by its own root. -->
|
||||
<div id=below></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id=outside></div>
|
||||
</template>
|
||||
<script>
|
||||
test((t) => {
|
||||
t.add_cleanup(() => main.replaceChildren());
|
||||
main.append(test_nest_scope_end.content.cloneNode(true));
|
||||
|
||||
assert_equals(getComputedStyle(below).zIndex, 'auto');
|
||||
assert_equals(getComputedStyle(outside).zIndex, 'auto');
|
||||
}, 'Nesting-selector in <scope-end>');
|
||||
</script>
|
||||
|
||||
<template id=test_nest_scope_end_implicit_scope>
|
||||
<div>
|
||||
<style>
|
||||
/* (.b) behaves like (:scope .b), due :scope being prepended
|
||||
implicitly. */
|
||||
@scope (.a) to (.b) {
|
||||
:scope { z-index:1; }
|
||||
}
|
||||
|
||||
/* Should not match, since <scope-end> refers to the scope itself. */
|
||||
@scope (.a) to (.b:scope) {
|
||||
:scope { z-index:42; }
|
||||
}
|
||||
</style>
|
||||
<div class="a b">
|
||||
<div class=b>
|
||||
<div id=below></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id=outside></div>
|
||||
</template>
|
||||
<script>
|
||||
test((t) => {
|
||||
t.add_cleanup(() => main.replaceChildren());
|
||||
main.append(test_nest_scope_end_implicit_scope.content.cloneNode(true));
|
||||
let a = document.querySelector('.a');
|
||||
let b = document.querySelector('.a > .b');
|
||||
assert_equals(getComputedStyle(a).zIndex, '1');
|
||||
assert_equals(getComputedStyle(b).zIndex, 'auto');
|
||||
assert_equals(getComputedStyle(below).zIndex, 'auto');
|
||||
assert_equals(getComputedStyle(outside).zIndex, 'auto');
|
||||
}, 'Implicit :scope in <scope-end>');
|
||||
</script>
|
||||
|
||||
<template id=test_relative_selector_scope_end>
|
||||
<div>
|
||||
<style>
|
||||
@scope (.a) to (> .b) {
|
||||
*, :scope { z-index:1; }
|
||||
}
|
||||
</style>
|
||||
<div class="a b">
|
||||
<div class=b>
|
||||
<div id=below></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id=outside></div>
|
||||
</template>
|
||||
<script>
|
||||
test((t) => {
|
||||
t.add_cleanup(() => main.replaceChildren());
|
||||
main.append(test_relative_selector_scope_end.content.cloneNode(true));
|
||||
let a = document.querySelector('.a');
|
||||
let b = document.querySelector('.a > .b');
|
||||
assert_equals(getComputedStyle(a).zIndex, '1');
|
||||
assert_equals(getComputedStyle(b).zIndex, 'auto');
|
||||
assert_equals(getComputedStyle(below).zIndex, 'auto');
|
||||
assert_equals(getComputedStyle(outside).zIndex, 'auto');
|
||||
}, 'Relative selectors in <scope-end>');
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue