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

Side by Side Diff: LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex.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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <select id="test" size="3"> 1 <select 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", "1"); 19 shouldBe("mySelect.selectedIndex", "1");
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", "1"); 24 shouldBe("mySelect.selectedIndex", "1");
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
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", "-1"); 138 shouldBe("mySelect.selectedIndex", "-1");
139 139
140 debug((++i) + ") trying to add a non-option element"); 140 debug((++i) + ") trying to add a non-option element");
141 shouldThrow("mySelect.options.add({})"); 141 shouldThrow("mySelect.options.add({})");
142 shouldBe("mySelect.options.length", "10"); 142 shouldBe("mySelect.options.length", "10");
143 shouldBe("mySelect.selectedIndex", "-1"); 143 shouldBe("mySelect.selectedIndex", "-1");
144 144
145 debug((++i) + ") setting length to a value greater than 10000");
146 mySelect.options.length = 10001;
147 shouldBe("mySelect.options.length", "10");
148 shouldBe("mySelect.selectedIndex", "-1");
149
145 debug(""); 150 debug("");
146 </script> 151 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698