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

Side by Side Diff: LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple.html

Issue 1292653003: [bindings] Avoid using custom binding for HTMLOptionsCollection.length attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed to fix the test case! Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 <select multiple id="test" size="3"> 1 <select multiple id="test" size="3">
2 </select> 2 </select>
3 <div id="console"></div> 3 <div id="console"></div>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script> 5 <script>
6 function reset(mySelect) { 6 function reset(mySelect) {
7 mySelect.length = 0; 7 mySelect.length = 0;
8 mySelect.options[mySelect.length] = new Option("one", "value", true, true); 8 mySelect.options[mySelect.length] = new Option("one", "value", true, true);
9 mySelect.options[mySelect.length] = new Option("two", "value", true, true); 9 mySelect.options[mySelect.length] = new Option("two", "value", true, true);
10 } 10 }
11 11
12 var mySelect = document.getElementById("test"); 12 var mySelect = document.getElementById("test");
13 reset(mySelect); 13 reset(mySelect);
14 var i = 0; 14 var i = 0;
15 15
16 debug((++i) + ") setting length to a negative length"); 16 debug((++i) + ") setting length to a negative length");
17 shouldThrow("mySelect.options.length = -1;"); 17 mySelect.options.length = -1;
18 shouldBe("mySelect.options.length", "2"); 18 shouldBe("mySelect.options.length", "2");
19 shouldBe("mySelect.selectedIndex", "0"); 19 shouldBe("mySelect.selectedIndex", "0");
20 20
21 debug((++i) + ") setting length to a larger length"); 21 debug((++i) + ") setting length to a larger length");
22 mySelect.options.length = 5; 22 mySelect.options.length = 5;
23 shouldBe("mySelect.options.length", "5"); 23 shouldBe("mySelect.options.length", "5");
24 shouldBe("mySelect.selectedIndex", "0"); 24 shouldBe("mySelect.selectedIndex", "0");
25 25
26 debug((++i) + ") setting length to a smaller length"); 26 debug((++i) + ") setting length to a smaller length");
27 mySelect.options.length = 2; 27 mySelect.options.length = 2;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 debug((++i) + ") trying to set a option element using an invalid index: NaN"); 130 debug((++i) + ") trying to set a option element using an invalid index: NaN");
131 mySelect.options[0/0] = document.createElement("option"); 131 mySelect.options[0/0] = document.createElement("option");
132 shouldBe("mySelect.options.length", "10"); 132 shouldBe("mySelect.options.length", "10");
133 shouldBe("mySelect.selectedIndex", "0"); 133 shouldBe("mySelect.selectedIndex", "0");
134 134
135 debug((++i) + ") trying to set a option element using an invalid index: positive infinity"); 135 debug((++i) + ") trying to set a option element using an invalid index: positive infinity");
136 mySelect.options[1/0] = document.createElement("option"); 136 mySelect.options[1/0] = document.createElement("option");
137 shouldBe("mySelect.options.length", "10"); 137 shouldBe("mySelect.options.length", "10");
138 shouldBe("mySelect.selectedIndex", "0"); 138 shouldBe("mySelect.selectedIndex", "0");
139 139
140 debug((++i) + ") setting length to a value greater than 10000");
141 mySelect.options.length = 10001;
142 shouldBe("mySelect.options.length", "10");
143 shouldBe("mySelect.selectedIndex", "0");
144
140 debug(""); 145 debug("");
141 </script> 146 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698