1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
7 <p id="description"></p>
8 <div id="console"></div>
10 description('Tests for writing and reading .type property of HTMLInputElement.');
12 var input = document.createElement('input');
13 document.body.appendChild(input);
15 // The default type is "text".
16 shouldBe('input.type', '"text"');
18 function check(value, expected)
21 if (input.type == expected)
22 testPassed('input.type for "' + value + '" is correctly "' + input.type + '".');
24 testFailed('input.type for "' + value + '" is incorrectly "' + input.type + '", should be "' + expected + '".');
27 // The type is not specified explicitly. We can change it to "file".
28 check("file", "file");
29 // http://webkit.org/b/57343
30 check("file", "file");
31 check("FILE", "file");
33 check("text", "text");
34 check("TEXT", "text"); // input.type must return a lower case value according to DOM Level 2.
35 check(" text ", "text");
36 check("button", "button");
37 check(" button ", "text");
38 check("checkbox", "checkbox");
39 check("email", "email");
40 check("file", "email"); // We can't change a concrete type to file for a security reason.
41 check("hidden", "hidden");
42 check("image", "image");
43 check("isindex", "text");
44 check("number", "number");
45 check("password", "password");
46 check("passwd", "text");
47 check("radio", "radio");
48 check("range", "range");
49 check("reset", "reset");
50 check("search", "search");
51 check("submit", "submit");
53 check("telephone", "text");
58 <script src="../../fast/js/resources/js-test-post.js"></script>