OLD | NEW |
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 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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", "-1"); | 133 shouldBe("mySelect.selectedIndex", "-1"); |
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", "-1"); | 138 shouldBe("mySelect.selectedIndex", "-1"); |
139 | 139 |
| 140 debug((++i) + ") trying to add a non-option element"); |
| 141 shouldThrow("mySelect.options.add({})"); |
| 142 shouldBe("mySelect.options.length", "10"); |
| 143 shouldBe("mySelect.selectedIndex", "-1"); |
| 144 |
140 debug(""); | 145 debug(""); |
141 </script> | 146 </script> |
OLD | NEW |