Index: third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/valueMode.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/valueMode.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/valueMode.html |
index 709c176dd631d2fa8b2ca4a1900d7ead384c21f4..6d5bc47bef4bc7f9487151d6d81366e3257b153c 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/valueMode.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/valueMode.html |
@@ -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"); |
- |
- 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"); |
- } |
+// 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"); |
+ 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, "on"); |
+}, "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, "bar"); |
+}, "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, "on"); |
+}, "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, "bar"); |
+}, "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> |