mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision 9817f7f027fe1e92cc2fce31d6002c4d669918e8
This commit is contained in:
parent
8e52f8a523
commit
f3533538ea
2144 changed files with 21364 additions and 11001 deletions
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#autofocusing-a-form-control:-the-autofocus-attribute">
|
||||
<link rel="author" title="Domenic Denicola" href="d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<input autofocus>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const input1 = document.querySelector("input");
|
||||
|
||||
const input2 = document.createElement("input");
|
||||
input2.autofocus = true;
|
||||
document.body.prepend(input2);
|
||||
|
||||
step_timeout(() => {
|
||||
assert_equals(document.activeElement, input1);
|
||||
assert_not_equals(document.activeElement, input2);
|
||||
|
||||
done();
|
||||
}, 100);
|
||||
</script>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>The first autofocus in the document wins, even if elements are inserted later</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#autofocusing-a-form-control:-the-autofocus-attribute">
|
||||
<link rel="author" title="Domenic Denicola" href="d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<input autofocus>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const input1 = document.querySelector("input");
|
||||
|
||||
const input2 = document.createElement("input");
|
||||
input2.autofocus = true;
|
||||
document.body.appendChild(input2);
|
||||
|
||||
step_timeout(() => {
|
||||
assert_equals(document.activeElement, input1);
|
||||
assert_not_equals(document.activeElement, input2);
|
||||
|
||||
done();
|
||||
}, 100);
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>The first autofocus in the document wins</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#autofocusing-a-form-control:-the-autofocus-attribute">
|
||||
<link rel="author" title="Domenic Denicola" href="d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<input autofocus>
|
||||
<input autofocus>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const [input1, input2] = document.querySelectorAll("input");
|
||||
|
||||
step_timeout(() => {
|
||||
assert_equals(document.activeElement, input1);
|
||||
assert_not_equals(document.activeElement, input2);
|
||||
|
||||
done();
|
||||
}, 100);
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>The element is not focused during the initial parsing task</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#autofocusing-a-form-control:-the-autofocus-attribute">
|
||||
<link rel="author" title="Domenic Denicola" href="d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<input autofocus>
|
||||
<input autofocus>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const input = document.querySelector("input");
|
||||
|
||||
assert_equals(document.activeElement, document.body);
|
||||
assert_not_equals(document.activeElement, input);
|
||||
|
||||
done();
|
||||
</script>
|
|
@ -0,0 +1,123 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title></title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<form id="form"><input id="form-input" type="text" value="abc" /></form>
|
||||
<script>
|
||||
// * Should we test setting the dirty flag in any way that isn't
|
||||
// setting the value?
|
||||
// * How to simulate users typing?
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
assert_equals(el.selectionStart, 0);
|
||||
assert_equals(el.selectionEnd, 0);
|
||||
el.defaultValue = "123";
|
||||
assert_equals(el.value.length, 3);
|
||||
assert_equals(el.selectionStart, 3);
|
||||
assert_equals(el.selectionEnd, 3);
|
||||
}, "Setting defaultValue in a textarea should move the cursor to the end");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.value = "abcdef";
|
||||
assert_equals(el.selectionStart, 6);
|
||||
assert_equals(el.selectionEnd, 6);
|
||||
el.defaultValue = "123";
|
||||
assert_equals(el.value.length, 6);
|
||||
assert_equals(el.selectionStart, 6);
|
||||
assert_equals(el.selectionEnd, 6);
|
||||
}, "Setting defaultValue in a textarea with a value should NOT make any difference");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.appendChild(document.createTextNode("abcdef"));
|
||||
assert_equals(el.selectionStart, 6);
|
||||
assert_equals(el.selectionEnd, 6);
|
||||
el.textContent = "abcdef123456";
|
||||
assert_equals(el.selectionStart, 12);
|
||||
assert_equals(el.selectionEnd, 12);
|
||||
}, "Setting textContent in a textarea should move selection{Start,End} to the end");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.appendChild(document.createTextNode("abcdef"));
|
||||
assert_equals(el.selectionStart, 6);
|
||||
assert_equals(el.selectionEnd, 6);
|
||||
el.appendChild(document.createTextNode("123456"));
|
||||
assert_equals(el.selectionStart, 12);
|
||||
assert_equals(el.selectionEnd, 12);
|
||||
}, "Adding children to a textarea should move selection{Start,End} to the end");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.appendChild(document.createTextNode("abcdef"));
|
||||
el.appendChild(document.createTextNode("123"));
|
||||
assert_equals(el.selectionStart, 9);
|
||||
assert_equals(el.selectionEnd, 9);
|
||||
|
||||
el.removeChild(el.firstChild);
|
||||
assert_equals(el.selectionStart, 3);
|
||||
assert_equals(el.selectionEnd, 3);
|
||||
}, "Removing children from a textarea should update selection{Start,End}");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.textContent = "abcdef\nwhatevs";
|
||||
el.selectionStart = 3;
|
||||
el.selectionEnd = 5;
|
||||
|
||||
el.textContent = "abcdef\r\nwhatevs";
|
||||
assert_equals(el.selectionStart, 3);
|
||||
assert_equals(el.selectionEnd, 5);
|
||||
}, "Setting the same value (with different newlines) in a textarea should NOT update selection{Start,End}");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("textarea");
|
||||
el.defaultValue = "123";
|
||||
assert_equals(el.value.length, 3);
|
||||
assert_equals(el.selectionStart, 3);
|
||||
assert_equals(el.selectionEnd, 3);
|
||||
el.value = "12";
|
||||
assert_equals(el.value.length, 2);
|
||||
assert_equals(el.selectionStart, 2);
|
||||
assert_equals(el.selectionEnd, 2);
|
||||
}, "Setting value to a shorter string than defaultValue should correct the cursor position");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("input");
|
||||
el.type = "text";
|
||||
el.value = "http://example.com ";
|
||||
assert_equals(el.selectionStart, 21);
|
||||
assert_equals(el.selectionEnd, 21);
|
||||
el.type = "url";
|
||||
assert_equals(el.selectionStart, 18);
|
||||
assert_equals(el.selectionEnd, 18);
|
||||
}, "Shortening value by turning the input type into 'url' should correct selection{Start,End}");
|
||||
|
||||
test(function() {
|
||||
var el = document.createElement("input");
|
||||
el.type = "text";
|
||||
el.value = "#123456xx";
|
||||
assert_equals(el.selectionStart, 9);
|
||||
assert_equals(el.selectionEnd, 9);
|
||||
el.type = "color";
|
||||
el.type = "text";
|
||||
assert_equals(el.selectionStart, 7);
|
||||
assert_equals(el.selectionEnd, 7);
|
||||
}, "Shortening value by turning the input type into 'color' and back to 'text' should correct selection{Start,End}");
|
||||
|
||||
test(function() {
|
||||
var form = document.getElementById("form");
|
||||
var el = document.getElementById("form-input");
|
||||
|
||||
el.value = "abcde";
|
||||
assert_equals(el.value.length, 5);
|
||||
form.reset();
|
||||
assert_equals(el.value.length, 3);
|
||||
assert_equals(el.selectionStart, 3);
|
||||
assert_equals(el.selectionEnd, 3);
|
||||
}, "Resetting a value to a shorter string than defaultValue should correct the cursor position");
|
||||
</script>
|
|
@ -31,7 +31,7 @@
|
|||
</fieldset>
|
||||
<fieldset id=fs4 disabled>
|
||||
<legend>
|
||||
<fieldset><input type=checkbox id=club4></fieldset>
|
||||
<fieldset id=fs4-1><input type=checkbox id=club4></fieldset>
|
||||
</legend>
|
||||
<p><label>Name on card: <input id=clubname4 required></label></p>
|
||||
<p><label>Card number: <input id=clubnum4 required pattern="[-0-9]+"></label></p>
|
||||
|
@ -68,4 +68,11 @@
|
|||
assert_false(document.getElementById('clubnum4').willValidate, "fieldset is disabled so is input 'clubnum4'");
|
||||
assert_true(document.getElementById('club4').willValidate, "the first legend a child of the disabled fieldset: input 'club4' is disabled");
|
||||
}, "The <legend> element is child of the disabled fieldset: Its descendants should be disabled.");
|
||||
|
||||
test(function () {
|
||||
let fs41 = document.querySelector('#fs4-1');
|
||||
fs41.disabled = true;
|
||||
assert_true(fs41.disabled, "The fieldset in a legend is disabled");
|
||||
assert_false(document.getElementById('club4').willValidate, "In a disabled fieldset in the first legend child of another disabled fieldset: input 'club4' is disabled");
|
||||
}, "A <fieldset> element is in the <legend> element of another disabled <fieldset>: Its descendants should be disabled.");
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue