mirror of
https://github.com/servo/servo.git
synced 2025-08-31 01:58:23 +01:00
Update web-platform-tests to revision 9c2bea6dac36e36ba1f489d10c2be42160d8f34f
This commit is contained in:
parent
482923cec2
commit
5c371dd958
459 changed files with 10717 additions and 834 deletions
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS Selectors Invalidation: :defined</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/selectors-4/">
|
||||
<meta name="assert" content="This tests that the :defined selector is effective">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-defined">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#container {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
#a1:defined {
|
||||
color: blue;
|
||||
}
|
||||
:defined + #b1 {
|
||||
color: green;
|
||||
}
|
||||
:defined > #c1 {
|
||||
color: red;
|
||||
}
|
||||
div + :defined + * #d1 {
|
||||
color: yellow;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<section id="container">
|
||||
<elucidate-late id="a1"></elucidate-late>
|
||||
<div id="b1"></div>
|
||||
<elucidate-late>
|
||||
<div id="c1"></div>
|
||||
</elucidate-late>
|
||||
<div>
|
||||
<div id="d1"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
const gray = "rgb(128, 128, 128)";
|
||||
const blue = "rgb(0, 0, 255)";
|
||||
const green = "rgb(0, 128, 0)";
|
||||
const red = "rgb(255, 0, 0)";
|
||||
const yellow = "rgb(255, 255, 0)";
|
||||
|
||||
function assertGray(a, b, c, d) {
|
||||
assert_equals(getComputedStyle(a).color, gray);
|
||||
assert_equals(getComputedStyle(b).color, gray);
|
||||
assert_equals(getComputedStyle(c).color, gray);
|
||||
assert_equals(getComputedStyle(d).color, gray);
|
||||
}
|
||||
|
||||
function assertColorful(a, b, c, d) {
|
||||
assert_equals(getComputedStyle(a).color, blue);
|
||||
assert_equals(getComputedStyle(b).color, green);
|
||||
assert_equals(getComputedStyle(c).color, red);
|
||||
assert_equals(getComputedStyle(d).color, yellow);
|
||||
}
|
||||
|
||||
class ElucidateLate extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
test(() => {
|
||||
assertGray(a1, b1, c1, d1);
|
||||
customElements.define('elucidate-late', ElucidateLate);
|
||||
assertColorful(a1, b1, c1, d1);
|
||||
}, ":defined selector is effective");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Selectors Invalidation: :enabled and :disabled</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/selectors-4/#enableddisabled">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/#enabling-and-disabling-form-controls:-the-disabled-attribute">
|
||||
<meta name="assert" content="This tests that the :enabled and :disabled selectors are effective, and that the enabled/disabled status of an element is changed when updating its 'disabled' attribute by script.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
input {
|
||||
position: absolute;
|
||||
left: 200px;
|
||||
top: 300px;
|
||||
}
|
||||
|
||||
:enabled {
|
||||
left: 100px;
|
||||
}
|
||||
|
||||
:disabled {
|
||||
top: 400px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<input id="first" type="button" value="First"></input>
|
||||
<input id="second" type="button" value="Second" disabled></input>
|
||||
|
||||
<script>
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(first).left, '100px');
|
||||
assert_equals(getComputedStyle(first).top, '300px');
|
||||
|
||||
first.disabled = true;
|
||||
assert_equals(getComputedStyle(first).left, '200px');
|
||||
assert_equals(getComputedStyle(first).top, '400px');
|
||||
}, "Element updates when disabled");
|
||||
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(second).left, '200px');
|
||||
assert_equals(getComputedStyle(second).top, '400px');
|
||||
|
||||
second.disabled = false;
|
||||
assert_equals(getComputedStyle(second).left, '100px');
|
||||
assert_equals(getComputedStyle(second).top, '300px');
|
||||
}, "Element updates when enabled");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Selectors Invalidation: :first-child :last-child</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-first-child-pseudo">
|
||||
<meta name="assert" content="This tests that the :first-child and :last-child selectors are effective">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
div {
|
||||
color: black;
|
||||
}
|
||||
span:first-child {
|
||||
color: blue;
|
||||
}
|
||||
span:last-child {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"><span>first-initially</span><span>last-initially</span></div>
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
const black = 'rgb(0, 0, 0)';
|
||||
const blue = 'rgb(0, 0, 255)';
|
||||
const red = 'rgb(255, 0, 0)';
|
||||
|
||||
test(() => {
|
||||
const target = document.querySelector('#target');
|
||||
const first = target.firstChild;
|
||||
assert_equals(getComputedStyle(first).color, blue);
|
||||
target.insertAdjacentHTML('afterbegin', '\n<span>foo</span><span>bar</span>');
|
||||
assert_equals(getComputedStyle(target.firstElementChild).color, blue);
|
||||
assert_equals(getComputedStyle(first).color, black);
|
||||
while (target.firstElementChild !== first)
|
||||
target.removeChild(target.firstElementChild);
|
||||
assert_equals(getComputedStyle(first).color, blue);
|
||||
}, 'Adding multiple nodes at once should invalidate :first-child correctly.');
|
||||
|
||||
test(() => {
|
||||
const target = document.querySelector('#target');
|
||||
const last = target.lastChild;
|
||||
assert_equals(getComputedStyle(last).color, red);
|
||||
target.insertAdjacentHTML('beforeend', '\n<span>foo</span><span>bar</span>');
|
||||
assert_equals(getComputedStyle(target.lastChild).color, red);
|
||||
assert_equals(getComputedStyle(last).color, black);
|
||||
while (target.lastChild !== last)
|
||||
target.removeChild(target.lastChild);
|
||||
assert_equals(getComputedStyle(last).color, red);
|
||||
}, 'Adding multiple nodes at once should invalidate :last-child correctly.');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue