Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534

Fixes #15648.
This commit is contained in:
Ms2ger 2017-02-20 11:44:42 +01:00
parent a1e4c547f0
commit 4fadf9b0b6
1184 changed files with 22551 additions and 9856 deletions

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>This is the form that will be submitted</title>
<form action="form-echo.py" method="post" enctype="text/plain">
<input id="input1" type="text">
<select id="input2">
<option selected>option
</select>
<input id="input3" type="radio" checked>
<input id="input4" type="checkbox" checked>
</form>
<script>
"use strict";
const form = document.querySelector("form");
for (let el of Array.from(form.querySelectorAll("input"))) { // Firefox/Edge support
el.name = el.id + "\uDC01";
el.value = el.id + "\uDC01";
}
const select = document.querySelector("select");
select.name = select.id + "\uDC01";
select.firstElementChild.value = select.id + "\uDC01";
</script>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Submitting a form data set that contains unpaired surrogates must convert to Unicode scalar values</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#constructing-form-data-set">
<link rel="help" href="https://github.com/whatwg/html/issues/1490">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="testframe" src="form-data-set-usv-form.html"></iframe>
<script>
"use strict";
async_test(t => {
window.onload = t.step_func(() => {
const iframe = document.querySelector("#testframe");
const form = iframe.contentWindow.document.querySelector("form");
iframe.onload = t.step_func_done(() => {
const result = iframe.contentWindow.document.body.textContent;
assert_equals(result,
"69 6e 70 75 74 31 ef bf bd 3d 69 6e 70 75 74 31 ef bf bd " + // input1\uFFFD=input1\uFFFD
"0d 0a " + // \r\n
"69 6e 70 75 74 32 ef bf bd 3d 69 6e 70 75 74 32 ef bf bd " + // input2\uFFFD=input2\uFFFD
"0d 0a " + // \r\n
"69 6e 70 75 74 33 ef bf bd 3d 69 6e 70 75 74 33 ef bf bd " + // input3\uFFFD=input3\uFFFD
"0d 0a " + // \r\n
"69 6e 70 75 74 34 ef bf bd 3d 69 6e 70 75 74 34 ef bf bd " + // input4\uFFFD=input4\uFFFD
"0d 0a" // \r\n
);
// ef bf bd is the UTF-8 encoding of U+FFFD
});
form.submit();
});
});
</script>

View file

@ -0,0 +1,7 @@
def main(request, response):
bytes = bytearray(request.raw_input.read())
bytes_string = " ".join("%02x" % b for b in bytes)
return (
[("Content-Type", "text/plain")],
bytes_string
)

View file

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<title>Test that nobody implemented the now-removed menu type and attribute on button</title>
<meta charset="utf-8">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://github.com/whatwg/html/pull/2342">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<button id="b" type="menu" menu="m">button</button>
<menu id="m"></menu>
<script>
"use strict";
const button = document.querySelector("button");
test(() => {
assert_false('menu' in button, 'The menu property must not exist on the button');
assert_equals(button.menu, undefined, 'The value of the menu property on the button must be undefined');
}, 'button.menu, the potentially-reflecting IDL attribute, does not exist');
test(() => {
assert_equals(button.type, 'submit', 'The type property must reflect as its invalid value default of submit');
}, 'button.type reflects properly');
</script>

View file

@ -57,9 +57,18 @@ test(function() {
input.type = type;
assert_equals(input.type, type, "the given input type is not supported");
assert_throws("INVALID_STATE_ERR", function() { input.select(); });
var selectionStartBefore = input.selectionStart;
var selectionEndBefore = input.selectionEnd;
var selectionDirectionBefore = input.selectionDirection;
}, "input type " + type + " should not support the select() method");
// Does not throw; see https://github.com/whatwg/html/issues/2275
input.select();
assert_equals(input.selectionStart, selectionStartBefore, "selectionStart must not change");
assert_equals(input.selectionEnd, selectionEndBefore, "selectionEnd must not change");
assert_equals(input.selectionDirection, selectionDirectionBefore, "selectionDirection must not change");
}, "input type " + type + " should do nothing when the select() method is called (but, not throw)");
});
});

View file

@ -6,67 +6,300 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var types = [
{ type: "hidden", mode: "default" },
{ type: "text", mode: "value", sanitizedValue: "foo" },
{ type: "search", mode: "value", sanitizedValue: "foo" },
{ type: "tel", mode: "value", sanitizedValue: "foo" },
{ type: "url", mode: "value", sanitizedValue: "foo" },
{ type: "email", mode: "value", sanitizedValue: "foo" },
{ type: "password", mode: "value", sanitizedValue: "foo" },
{ type: "datetime-local", mode: "value", sanitizedValue: "" },
{ type: "date", mode: "value", sanitizedValue: "" },
{ type: "month", mode: "value", sanitizedValue: "" },
{ type: "week", mode: "value", sanitizedValue: "" },
{ type: "time", mode: "value", sanitizedValue: "" },
{ type: "number", mode: "value", sanitizedValue: "" },
{ type: "range", mode: "value", sanitizedValue: "50" },
{ type: "color", mode: "value", sanitizedValue: "#000000" },
{ type: "checkbox", mode: "default/on" },
{ type: "radio", mode: "default/on" },
{ type: "submit", mode: "default" },
{ type: "image", mode: "default" },
{ type: "reset", mode: "default" },
{ type: "button", mode: "default" }
];
for (var i = 0; i < types.length; i++) {
test(function() {
var input = document.createElement("input"),
expected;
input.type = types[i].type;
input.value = "foo";
switch(types[i].mode) {
case "default":
expected = "";
break;
case "default/on":
expected = "on";
break;
case "value":
expected = types[i].sanitizedValue;
break;
}
assert_equals(input.value, expected);
}, "value IDL attribute of input type " + types[i].type + " without value attribute");
// MODE DEFAULT
test(function () {
var input = document.createElement("input");
input.type = "hidden";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type hidden without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "hidden";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type hidden with value attribute");
test(function() {
var input = document.createElement("input"),
expected;
input.type = types[i].type;
input.setAttribute("value", "bar");
input.value = "foo";
switch(types[i].mode) {
case "default":
expected = "bar";
break;
case "default/on":
expected = "bar";
break;
case "value":
expected = types[i].sanitizedValue;
break;
}
assert_equals(input.value, expected);
}, "value IDL attribute of input type " + types[i].type + " with value attribute");
}
test(function () {
var input = document.createElement("input");
input.type = "submit";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type submit without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "submit";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type submit with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "image";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type image without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "image";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type image with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "reset";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type reset without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "reset";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type reset with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "button";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type button without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "button";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type button with value attribute");
// MODE DEFAULT/ON
test(function () {
var input = document.createElement("input");
input.type = "checkbox";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type checkbox without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "checkbox";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type checkbox with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "radio";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type radio without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "radio";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type radio with value attribute");
// MODE VALUE
test(function () {
var input = document.createElement("input");
input.type = "text";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type text without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "text";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type text with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "search";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type search without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "search";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type search with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "tel";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type tel without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "tel";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type tel with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "url";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type url without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "url";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type url with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "email";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type email without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "email";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type email with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "password";
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type password without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "password";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "foo");
}, "value IDL attribute of input type password with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "datetime-local";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type datetime-local without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "datetime-local";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type datetime-local with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "date";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type date without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "date";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type date with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "month";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type month without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "month";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type month with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "week";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type week without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "week";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type week with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "time";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type time without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "time";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type time with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "number";
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type number without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "number";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "");
}, "value IDL attribute of input type number with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "range";
input.value = "foo";
assert_equals(input.value, "50");
}, "value IDL attribute of input type range without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "range";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "50");
}, "value IDL attribute of input type range with value attribute");
test(function () {
var input = document.createElement("input");
input.type = "color";
input.value = "foo";
assert_equals(input.value, "#000000");
}, "value IDL attribute of input type color without value attribute");
test(function() {
var input = document.createElement("input");
input.type = "color";
input.setAttribute("value", "bar");
input.value = "foo";
assert_equals(input.value, "#000000");
}, "value IDL attribute of input type color with value attribute");
</script>

View file

@ -36,7 +36,7 @@
</form>
<script>
function testLabelsAttr(formElementId, labelElementId, hasLabels) {
function testLabelsAttr(formElementId, labelElementId) {
var elem = document.getElementById(formElementId);
if (labelElementId) {
assert_equals(elem.labels.length, 1);
@ -91,8 +91,24 @@ test(function() {
}, "Check if the hidden input element is not a labelable element.");
test(function() {
testLabelsAttr("testHidden", null);
}, "Check if the hidden input element can access 'labels'");
var hiddenInput = document.getElementById("testHidden");
assert_equals(hiddenInput.labels, null, "input[type=hidden] must have null .labels");
this.add_cleanup(function () {
hiddenInput.type = "hidden";
});
hiddenInput.type = "text";
testLabelsAttr("testHidden", "lbl5");
var labels = hiddenInput.labels;
hiddenInput.type = "hidden";
assert_equals(labels.length, 0, "Retained .labels NodeList should be empty after input type changed to hidden");
hiddenInput.type = "checkbox";
assert_true(labels === hiddenInput.labels, ".labels property must return the [SameObject] after input type is toggled back from 'hidden'");
assert_equals(hiddenInput.labels.length, 1, ".labels NodeList should contain the input after the input type is changed from 'hidden' to 'checkbox'");
}, "Check if the hidden input element has null 'labels'");
test(function() {
assert_equals(document.getElementById("lbl6").control.id, "testRadio", "An input element in radio state should be labelable.");