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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-type-change3-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/input-type-change3.html
diff --git a/LayoutTests/fast/forms/input-type-change3.html b/LayoutTests/fast/forms/input-type-change3.html
index 2d21017922b9d2ebf908f11990b72869762cdaf2..7d7076cf5eec4344462574059450030d250b91c5 100644
--- a/LayoutTests/fast/forms/input-type-change3.html
+++ b/LayoutTests/fast/forms/input-type-change3.html
@@ -1,59 +1,63 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
+<!DOCTYPE HTML>
<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
<script>
description('Tests for writing and reading .type property of HTMLInputElement.');
var input = document.createElement('input');
-document.body.appendChild(input);
// The default type is "text".
shouldBe('input.type', '"text"');
+shouldBeNull("input.getAttribute('type')");
-function check(value, expected)
+function check(value, expected, expectedAttributeValue)
{
input.type = value;
- if (input.type == expected)
+ if (input.type === expected)
testPassed('input.type for "' + value + '" is correctly "' + input.type + '".');
else
testFailed('input.type for "' + value + '" is incorrectly "' + input.type + '", should be "' + expected + '".');
+
+ if (typeof expectedAttributeValue === "undefined")
+ expectedAttributeValue = expected;
+
+ if (input.getAttribute('type') === expectedAttributeValue)
+ testPassed('input.getAttribute("type") for "' + value + '" is correctly "' + expectedAttributeValue + '".');
+ else
+ testFailed('input.getAttribute("type") for "' + value + '" is incorrectly "' + input.getAttribute('type') + '", should be "' + expectedAttributeValue + '".');
}
// The type is not specified explicitly. We can change it to "file".
check("file", "file");
// http://webkit.org/b/57343
check("file", "file");
-check("FILE", "file");
+check("FILE", "file", "FILE");
check("text", "text");
-check("TEXT", "text"); // input.type must return a lower case value according to DOM Level 2.
-check(" text ", "text");
+check("TEXT", "text", "TEXT"); // input.type must return a lower case value according to DOM Level 2.
+check(" text ", "text", " text ");
check("button", "button");
-check(" button ", "text");
+check(" button ", "text", " button ");
check("checkbox", "checkbox");
check("email", "email");
check("file", "email"); // We can't change a concrete type to file for a security reason.
check("hidden", "hidden");
check("image", "image");
-check("isindex", "text");
+check("isindex", "text", "isindex");
check("number", "number");
check("password", "password");
-check("passwd", "text");
+check("passwd", "text", "passwd");
check("radio", "radio");
check("range", "range");
check("reset", "reset");
check("search", "search");
check("submit", "submit");
check("tel", "tel");
-check("telephone", "text");
+check("telephone", "text", "telephone");
check("url", "url");
-check("uri", "text");
+check("uri", "text", "uri");
+// Empty and unknown value handling.
+check("", "text", "");
+check("x-unknown", "text", "x-unknown");
+shouldBeNull("input.removeAttribute('type'); input.getAttribute('type')");
</script>
-</body>
-</html>
« 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