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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 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
Index: third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html b/third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html
index 64b88f30cbf246b814dd4430aa2e7da239786625..b62a38c3c477d8a0a1ad140258ca5ae15d9dafb2 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/boolean-attribute-reflection.html
@@ -4,6 +4,70 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/boolean-attribute-reflection.js"></script>
+<script>
+description("Test reflecting boolean attributes.");
+
+var attributes = [
+ [ "area", "noHref" ],
+ [ "dir", "compact" ],
+ [ "dl", "compact" ],
+ [ "form", "noValidate" ],
+ [ "frame", "noResize" ],
+ [ "hr", "noShade" ],
+ [ "iframe", "allowFullscreen" ],
+ [ "img", "isMap" ],
+ [ "input", "autofocus" ],
+ [ "input", "defaultChecked", "checked" ],
+ [ "input", "disabled" ],
+ [ "input", "formNoValidate" ],
+ [ "input", "multiple" ],
+ [ "input", "readOnly" ],
+ [ "input", "required" ],
+ [ "link", "disabled" ],
+ [ "menu", "compact" ],
+ [ "menuitem", "checked" ],
+ [ "menuitem", "default" ],
+ [ "menuitem", "disabled" ],
+ [ "object", "declare" ],
+ [ "ol", "compact" ],
+ [ "option", "defaultSelected", "selected" ],
+ [ "script", "defer" ],
+ [ "select", "multiple" ],
+ [ "td", "noWrap" ],
+ [ "ul", "compact" ],
+ [ "video", "autoplay" ],
+ [ "video", "controls" ],
+ [ "video", "loop" ],
+];
+
+function make(tag)
+{
+ return document.createElement(tag);
+}
+
+for (var i = 0; i < attributes.length; ++i) {
+ var tag = attributes[i][0];
+ var reflectingAttribute = attributes[i][1];
+ var contentAttribute = attributes[i][2] || reflectingAttribute.toLowerCase();
+ shouldBe("e = make('" + tag + "'); "
+ + "e.removeAttribute('" + contentAttribute + "'); "
+ + "e." + reflectingAttribute,
+ "false");
+ shouldBe("e = make('" + tag + "'); "
+ + "e.setAttribute('" + contentAttribute + "', ''); "
+ + "e." + reflectingAttribute,
+ "true");
+ shouldBe("e = make('" + tag + "'); "
+ + "e.setAttribute('" + contentAttribute + "', 'x'); "
+ + "e." + reflectingAttribute + " = false; "
+ + "e.getAttribute('" + contentAttribute + "')",
+ "null");
+ shouldBe("e = make('" + tag + "'); "
+ + "e.setAttribute('" + contentAttribute + "', 'x'); "
+ + "e." + reflectingAttribute + " = true; "
+ + "e.getAttribute('" + contentAttribute + "')",
+ "''");
+}
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698