Update web-platform-tests to revision b'065cf84e9f00d1c11faf2a41e500a73ad6b95a48'

This commit is contained in:
WPT Sync Bot 2023-03-21 01:36:33 +00:00
parent 4931ee0eba
commit 4e30ee5e08
184 changed files with 7097 additions and 2788 deletions

View file

@ -70,10 +70,27 @@ test_scope(document.currentScript, () => {
</div>
</template>
<script>
test_scope(document.currentScript, () => {
assert_not_green('.a');
assert_not_green('.a > span');
}, 'Scope can not match its own root without :scope');
</script>
<template>
<style>
@scope (.a) {
:scope { background-color: green; }
}
</style>
<div class=a> <!-- green -->
<span>not green</span>
</div>
</template>
<script>
test_scope(document.currentScript, () => {
assert_green('.a');
assert_not_green('.a > span');
}, 'Single scope (self)');
}, 'Selecting self with :scope');
</script>
<template>
@ -354,7 +371,7 @@ test_scope(document.currentScript, () => {
test_scope(document.currentScript, () => {
assert_not_green('#above');
assert_not_green('#adjacent');
assert_green('.a');
assert_not_green('.a');
assert_green('.a > div');
assert_not_green('.b');
assert_not_green('#below');
@ -382,7 +399,7 @@ test_scope(document.currentScript, () => {
test_scope(document.currentScript, () => {
assert_not_green('#above');
assert_not_green('#adjacent');
assert_green('.a');
assert_not_green('.a');
assert_green('.a > div');
assert_green('.b');
assert_not_green('#limit');
@ -457,3 +474,40 @@ test_scope(document.currentScript, () => {
assert_not_green('.c');
}, ':scope indirect adjacent sibling');
</script>
<template>
<style>
@scope (.a) {
> span { background-color: green; }
}
</style>
<div class=a>
<span>green</span>
</div>
</template>
<script>
test_scope(document.currentScript, () => {
assert_green('.a > span');
}, 'Relative selector inside @scope');
</script>
<template>
<style>
@scope (.a) {
/* Can never match anything. */
:scope > :scope { background-color: green; }
}
</style>
<div class=a>
<div id=inner class=a>
</div>
</div>
</template>
<script>
test_scope(document.currentScript, () => {
assert_not_green('.a');
assert_not_green('#inner');
}, ':scope in two different compounds');
</script>

View file

@ -109,3 +109,65 @@ test((t) => {
assert_equals(getComputedStyle(a).zIndex, 'auto');
}, '@scope with effectively empty :is() must not match anything');
</script>
<template id=test_implicit_descendant>
<div id=div>
<style>
@scope {
#div { z-index:1; }
}
</style>
</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_implicit_descendant.content.cloneNode(true));
assert_equals(getComputedStyle(div).zIndex, 'auto');
}, 'Implicit @scope has implicitly added :scope descendant combinator');
</script>
<template id=test_implicit_relative>
<div id=outer>
<style>
@scope {
> div { z-index:1; }
}
</style>
<div id=child>
<div id=inner></div>
</div>
</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_implicit_relative.content.cloneNode(true));
assert_equals(getComputedStyle(outer).zIndex, 'auto');
assert_equals(getComputedStyle(child).zIndex, '1');
assert_equals(getComputedStyle(inner).zIndex, 'auto');
}, 'Implicit @scope with inner relative selector');
</script>
<template id=test_implicit_descendant_nesting_selector>
<div id=div>
<style>
@scope {
/* Behaves like :scope */
& { z-index:1; }
}
</style>
<div id=inner></div>
</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_implicit_descendant_nesting_selector.content.cloneNode(true));
assert_equals(getComputedStyle(div).zIndex, '1');
assert_equals(getComputedStyle(inner).zIndex, 'auto');
}, 'Implicit @scope with inner nesting selector');
</script>

View file

@ -66,7 +66,7 @@ test_scope_invalidation(document.currentScript, () => {
<template>
<style>
@scope (.a) {
.b { background-color: green; }
:scope { background-color: green; }
}
</style>
<div class=b></div>
@ -79,10 +79,9 @@ test_scope_invalidation(document.currentScript, () => {
assert_green(b);
b.classList.remove('a');
assert_not_green(b);
}, 'Element becoming scope root, with inner selector matching that root');
}, 'Element becoming scope root, with inner :scope rule');
</script>
<template>
<style>
@scope (.a) to (.b) {

View file

@ -93,3 +93,28 @@ test((t) => {
assert_equals(getComputedStyle(outside).zIndex, 'auto');
}, 'Relative selectors in <scope-end>');
</script>
<template id=test_inner_nest>
<div>
<style>
@scope (.a) {
& + & {
z-index:1;
}
}
</style>
<div class=a>
<div id=inner1 class=a></div>
<div id=inner2 class=a></div>
</div>
</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_inner_nest.content.cloneNode(true));
assert_equals(getComputedStyle(inner1).zIndex, 'auto');
assert_equals(getComputedStyle(inner2).zIndex, '1');
}, 'Nesting-selector in the scope\'s <stylesheet>');
</script>