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

Side by Side 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: Update expected output for inspector/console/console-format-collections 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <body>
esprehn 2013/12/19 11:02:48 We usually leave out <html> and <body>
sof 2013/12/19 12:15:05 Done.
4 <script src="../../resources/js-test.js"></script>
5 <form id="f1">
6 <button id=n1></button>
7 <fieldset id=n1><legend id=legend1></legend></fieldset>
8 <input name=n1 type=hidden>
9 <input name=n1 type=image>
10 <input name=n1 type=text>
11 <input name=n1 type=radio>
12 <keygen id=n1></keygen>
13 <output id=n1></output>
14 <object name=n1></object>
15 <select name=n1><option id=n1></option></select>
16 <textarea id=n1></textarea>
17 <div id=n1></div>
18 <option id=n1></option>
19 </form>
20 <form id="f2">
21 <button id=n1></button>
esprehn 2013/12/19 11:02:48 You have duplicate ids in here, is that on purpose
sof 2013/12/19 12:15:05 It's key that they are for this test, yes.
22 <keygen id=n1></keygen>
23 <output id=n1></output>
24 <object name=n1></object>
25 <select name=n1><option id=n1></option></select>
26 <input name=n1 type=hidden>
27 <input name=n1 type=image>
28 <input name=n1 type=text>
29 <input name=n2 type=image>
30 <img name=n2></img>
31 <img id=n2></img>
32 </form>
33 <script>
34 description("Test RadioNodeLists returned by the HTMLFormElement named-getter.") ;
35
36 var form1 = document.getElementById("f1");
37 shouldBe("form1.elements.length", "10");
38
39 var radioNodeList;
40
41 function testListedElements() {
42 debug("Check that only 'listed elements' are included in the list, if any.") ;
43 radioNodeList = form1["n1"];
44 shouldBe("radioNodeList.length", "10");
45
46 shouldBeTrue("radioNodeList[0] instanceof HTMLButtonElement");
47 shouldBeTrue("radioNodeList[1] instanceof HTMLFieldSetElement");
48 shouldBeTrue("radioNodeList[2] instanceof HTMLInputElement");
49 shouldBe("radioNodeList[2].type", "'hidden'");
50 shouldBeTrue("radioNodeList[3] instanceof HTMLInputElement");
51 shouldBe("radioNodeList[3].type", "'text'");
52 shouldBeTrue("radioNodeList[4] instanceof HTMLInputElement");
53 shouldBe("radioNodeList[4].type", "'radio'");
54 shouldBeTrue("radioNodeList[5] instanceof HTMLKeygenElement");
55 shouldBeTrue("radioNodeList[6] instanceof HTMLOutputElement");
56 shouldBeTrue("radioNodeList[7] instanceof HTMLObjectElement");
57 shouldBeTrue("radioNodeList[8] instanceof HTMLSelectElement");
58 shouldBeTrue("radioNodeList[9] instanceof HTMLTextAreaElement");
59 debug("");
esprehn 2013/12/19 11:02:48 Remove this empty debug.
sof 2013/12/19 12:15:05 Done.
60 }
61
62 function testImageElement2ndPhase() {
esprehn 2013/12/19 11:02:48 Can this just be a separate test?
sof 2013/12/19 12:15:05 ok, done.
63 debug("Check that if no 'listed elements' match by name, img elements are pi cked instead.");
64
65 function verifyLength(n) {
66 shouldBe("radioNodeList.length", n.toString());
67 for (var i = 0; i < n; i++)
68 shouldBeTrue("radioNodeList[" + i + "] instanceof HTMLImageElement") ;
esprehn 2013/12/19 11:02:48 Dynamic tests like this are very hard to follow, I
sof 2013/12/19 12:15:05 ok, abstracted out.
69 }
70
71 var form2 = document.getElementById("f2");
72 radioNodeList = form2["n2"];
73 verifyLength(2);
74
75 var button = document.createElement("button");
76 button.name = "n2";
77 form2.appendChild(button);
78 verifyLength(2);
79
80 var img = document.createElement("img");
81 img.name = "n2";
82 form2.appendChild(img);
83 verifyLength(3);
84 }
85
86 testListedElements();
87 testImageElement2ndPhase();
88 </script>
89 <p id="description"></p>
90 </body>
91 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698