diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/forms/the-input-element/valueMode.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-input-element/valueMode.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/forms/the-input-element/valueMode.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-input-element/valueMode.html b/testing/web-platform/tests/html/semantics/forms/the-input-element/valueMode.html new file mode 100644 index 000000000..709c176dd --- /dev/null +++ b/testing/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-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"); + + 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> |