Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/valueMode.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Input element value mode</title>
4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
5 <script src="../../../../../../resources/testharness.js"></script>
6 <script src="../../../../../../resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <script>
9 var types = [
10 { type: "hidden", mode: "default" },
11 { type: "text", mode: "value", sanitizedValue: "foo" },
12 { type: "search", mode: "value", sanitizedValue: "foo" },
13 { type: "tel", mode: "value", sanitizedValue: "foo" },
14 { type: "url", mode: "value", sanitizedValue: "foo" },
15 { type: "email", mode: "value", sanitizedValue: "foo" },
16 { type: "password", mode: "value", sanitizedValue: "foo" },
17 { type: "datetime", mode: "value", sanitizedValue: "" },
18 { type: "date", mode: "value", sanitizedValue: "" },
19 { type: "month", mode: "value", sanitizedValue: "" },
20 { type: "week", mode: "value", sanitizedValue: "" },
21 { type: "time", mode: "value", sanitizedValue: "" },
22 { type: "number", mode: "value", sanitizedValue: "" },
23 { type: "range", mode: "value", sanitizedValue: "50" },
24 { type: "color", mode: "value", sanitizedValue: "#000000" },
25 { type: "checkbox", mode: "default/on" },
26 { type: "radio", mode: "default/on" },
27 { type: "submit", mode: "default" },
28 { type: "image", mode: "default" },
29 { type: "reset", mode: "default" },
30 { type: "button", mode: "default" }
31 ];
32 for (var i = 0; i < types.length; i++) {
33 test(function() {
34 var input = document.createElement("input"),
35 expected;
36 input.type = types[i].type;
37 input.value = "foo";
38 switch(types[i].mode) {
39 case "default":
40 expected = "";
41 break;
42 case "default/on":
43 expected = "on";
44 break;
45 case "value":
46 expected = types[i].sanitizedValue;
47 break;
48 }
49 assert_equals(input.value, expected);
50 }, "value IDL attribute of input type " + types[i].type + " without value at tribute");
51
52 test(function() {
53 var input = document.createElement("input"),
54 expected;
55 input.type = types[i].type;
56 input.setAttribute("value", "bar");
57 input.value = "foo";
58 switch(types[i].mode) {
59 case "default":
60 expected = "bar";
61 break;
62 case "default/on":
63 expected = "bar";
64 break;
65 case "value":
66 expected = types[i].sanitizedValue;
67 break;
68 }
69 assert_equals(input.value, expected);
70 }, "value IDL attribute of input type " + types[i].type + " with value attri bute");
71 }
72 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698