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

Unified Diff: LayoutTests/fast/forms/form-radio-node-list.html

Issue 119063002: Have HTMLFormElement's named getter return a RadioNodeList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a RadioImgNodeListType CollectionType and use it + test improvements. Created 7 years 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: LayoutTests/fast/forms/form-radio-node-list.html
diff --git a/LayoutTests/fast/forms/form-radio-node-list.html b/LayoutTests/fast/forms/form-radio-node-list.html
new file mode 100644
index 0000000000000000000000000000000000000000..238d1f5445394e5df8a7098684b259ddf07dbaa5
--- /dev/null
+++ b/LayoutTests/fast/forms/form-radio-node-list.html
@@ -0,0 +1,42 @@
+<!doctype html>
+<script src="../../resources/js-test.js"></script>
+<form id="f1">
+ <button id=n1></button>
+ <fieldset id=n1><legend id=legend1></legend></fieldset>
+ <input name=n1 type=hidden>
+ <input name=n1 type=image>
+ <input name=n1 type=text>
+ <input name=n1 type=radio>
+ <keygen id=n1></keygen>
+ <output id=n1></output>
+ <object name=n1></object>
+ <select name=n1><option id=n1></option></select>
+ <textarea id=n1></textarea>
+ <div id=n1></div>
+ <option id=n1></option>
+</form>
+<script>
+description("Test RadioNodeLists returned by the HTMLFormElement named-getter.");
+
+var form1 = document.getElementById("f1");
+shouldBe("form1.elements.length", "10");
+
+debug("Check that only 'listed elements' are included in the list, if any.");
+var radioNodeList = form1["n1"];
+shouldBe("radioNodeList.length", "10");
+
+shouldBeTrue("radioNodeList[0] instanceof HTMLButtonElement");
+shouldBeTrue("radioNodeList[1] instanceof HTMLFieldSetElement");
+shouldBeTrue("radioNodeList[2] instanceof HTMLInputElement");
+shouldBe("radioNodeList[2].type", "'hidden'");
tkent 2013/12/20 00:18:11 shouldBeEqualToString("...", "hidden"); is cleaner
sof 2013/12/20 07:02:12 Yes; done.
+shouldBeTrue("radioNodeList[3] instanceof HTMLInputElement");
+shouldBe("radioNodeList[3].type", "'text'");
tkent 2013/12/20 00:18:11 Ditto.
sof 2013/12/20 07:02:12 Done.
+shouldBeTrue("radioNodeList[4] instanceof HTMLInputElement");
+shouldBe("radioNodeList[4].type", "'radio'");
tkent 2013/12/20 00:18:11 Ditto.
sof 2013/12/20 07:02:12 Done.
+shouldBeTrue("radioNodeList[5] instanceof HTMLKeygenElement");
+shouldBeTrue("radioNodeList[6] instanceof HTMLOutputElement");
+shouldBeTrue("radioNodeList[7] instanceof HTMLObjectElement");
+shouldBeTrue("radioNodeList[8] instanceof HTMLSelectElement");
+shouldBeTrue("radioNodeList[9] instanceof HTMLTextAreaElement");
+</script>
+<p id="description"></p>
tkent 2013/12/20 00:18:11 nit: You don't need to write #description element.
sof 2013/12/20 07:02:12 Done.

Powered by Google App Engine
This is Rietveld 408576698