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

Side by Side Diff: LayoutTests/fast/forms/input-type-change3.html

Issue 141703028: Remove input.type = ""; quirk. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move tests to fast/dom/input-type-change3 Created 6 years, 10 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-type-change3-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script> 3 <script>
10 description('Tests for writing and reading .type property of HTMLInputElement.') ; 4 description('Tests for writing and reading .type property of HTMLInputElement.') ;
11 5
12 var input = document.createElement('input'); 6 var input = document.createElement('input');
13 document.body.appendChild(input);
14 7
15 // The default type is "text". 8 // The default type is "text".
16 shouldBe('input.type', '"text"'); 9 shouldBe('input.type', '"text"');
10 shouldBeNull("input.getAttribute('type')");
17 11
18 function check(value, expected) 12 function check(value, expected, expectedAttributeValue)
19 { 13 {
20 input.type = value; 14 input.type = value;
21 if (input.type == expected) 15 if (input.type === expected)
22 testPassed('input.type for "' + value + '" is correctly "' + input.type + '".'); 16 testPassed('input.type for "' + value + '" is correctly "' + input.type + '".');
23 else 17 else
24 testFailed('input.type for "' + value + '" is incorrectly "' + input.typ e + '", should be "' + expected + '".'); 18 testFailed('input.type for "' + value + '" is incorrectly "' + input.typ e + '", should be "' + expected + '".');
19
20 if (typeof expectedAttributeValue === "undefined")
21 expectedAttributeValue = expected;
22
23 if (input.getAttribute('type') === expectedAttributeValue)
24 testPassed('input.getAttribute("type") for "' + value + '" is correctly "' + expectedAttributeValue + '".');
25 else
26 testFailed('input.getAttribute("type") for "' + value + '" is incorrectl y "' + input.getAttribute('type') + '", should be "' + expectedAttributeValue + '".');
25 } 27 }
26 28
27 // The type is not specified explicitly. We can change it to "file". 29 // The type is not specified explicitly. We can change it to "file".
28 check("file", "file"); 30 check("file", "file");
29 // http://webkit.org/b/57343 31 // http://webkit.org/b/57343
30 check("file", "file"); 32 check("file", "file");
31 check("FILE", "file"); 33 check("FILE", "file", "FILE");
32 34
33 check("text", "text"); 35 check("text", "text");
34 check("TEXT", "text"); // input.type must return a lower case value according t o DOM Level 2. 36 check("TEXT", "text", "TEXT"); // input.type must return a lower case value acc ording to DOM Level 2.
35 check(" text ", "text"); 37 check(" text ", "text", " text ");
36 check("button", "button"); 38 check("button", "button");
37 check(" button ", "text"); 39 check(" button ", "text", " button ");
38 check("checkbox", "checkbox"); 40 check("checkbox", "checkbox");
39 check("email", "email"); 41 check("email", "email");
40 check("file", "email"); // We can't change a concrete type to file for a securit y reason. 42 check("file", "email"); // We can't change a concrete type to file for a securit y reason.
41 check("hidden", "hidden"); 43 check("hidden", "hidden");
42 check("image", "image"); 44 check("image", "image");
43 check("isindex", "text"); 45 check("isindex", "text", "isindex");
44 check("number", "number"); 46 check("number", "number");
45 check("password", "password"); 47 check("password", "password");
46 check("passwd", "text"); 48 check("passwd", "text", "passwd");
47 check("radio", "radio"); 49 check("radio", "radio");
48 check("range", "range"); 50 check("range", "range");
49 check("reset", "reset"); 51 check("reset", "reset");
50 check("search", "search"); 52 check("search", "search");
51 check("submit", "submit"); 53 check("submit", "submit");
52 check("tel", "tel"); 54 check("tel", "tel");
53 check("telephone", "text"); 55 check("telephone", "text", "telephone");
54 check("url", "url"); 56 check("url", "url");
55 check("uri", "text"); 57 check("uri", "text", "uri");
56 58
59 // Empty and unknown value handling.
60 check("", "text", "");
61 check("x-unknown", "text", "x-unknown");
62 shouldBeNull("input.removeAttribute('type'); input.getAttribute('type')");
57 </script> 63 </script>
58 </body>
59 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-type-change3-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698