| Index: LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/valueMode.html
|
| diff --git a/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/valueMode.html b/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/valueMode.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..eec61e249f9810fc1497651d01b077b9ec16c95f
|
| --- /dev/null
|
| +++ b/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/valueMode.html
|
| @@ -0,0 +1,72 @@
|
| +<!DOCTYPE html>
|
| +<meta charset=utf-8>
|
| +<title>Input element value mode</title>
|
| +<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
|
| +<script src="../../../../../../resources/testharness.js"></script>
|
| +<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", 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");
|
| +
|
| + 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");
|
| + }
|
| +</script>
|
|
|