| OLD | NEW |
| 1 description("This test checks the behavior of the remove() method on the select.
options object."); | 1 description("This test checks the behavior of the remove() method on the select.
options object."); |
| 2 | 2 |
| 3 var select1 = document.getElementById("select1"); | 3 var select1 = document.getElementById("select1"); |
| 4 var value; | 4 var value; |
| 5 | 5 |
| 6 debug("1.1 Remove (object) from empty Options"); | 6 debug("1.1 Remove (object) from empty Options"); |
| 7 value = document.createElement("DIV"); | 7 value = document.createElement("DIV"); |
| 8 shouldBe("select1.options.remove(value)", "undefined"); | 8 shouldBe("select1.options.remove(value)", "undefined"); |
| 9 shouldBe("select1.options.length", "0"); | 9 shouldBe("select1.options.length", "0"); |
| 10 shouldBe("select1.selectedIndex", "-1"); | 10 shouldBe("select1.selectedIndex", "-1"); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 debug(""); | 60 debug(""); |
| 61 | 61 |
| 62 debug("1.9 Remove (positive infinity) from empty Options"); | 62 debug("1.9 Remove (positive infinity) from empty Options"); |
| 63 value = 1/0; | 63 value = 1/0; |
| 64 shouldBe("select1.options.remove(value)", "undefined"); | 64 shouldBe("select1.options.remove(value)", "undefined"); |
| 65 shouldBe("select1.options.length", "0"); | 65 shouldBe("select1.options.length", "0"); |
| 66 shouldBe("select1.selectedIndex", "-1"); | 66 shouldBe("select1.selectedIndex", "-1"); |
| 67 debug(""); | 67 debug(""); |
| 68 | 68 |
| 69 debug("1.10 Remove no args from empty Options"); | 69 debug("1.10 Remove no args from empty Options"); |
| 70 shouldThrow("select1.options.remove()", "'TypeError: Not enough arguments'"); | 70 shouldThrow("select1.options.remove()", '"TypeError: Failed to execute \'remove\
' on \'HTMLOptionsCollection\': 1 argument required, but only 0 present."'); |
| 71 shouldBe("select1.options.length", "0"); | 71 shouldBe("select1.options.length", "0"); |
| 72 shouldBe("select1.selectedIndex", "-1"); | 72 shouldBe("select1.selectedIndex", "-1"); |
| 73 debug(""); | 73 debug(""); |
| 74 | 74 |
| 75 debug("1.11 Remove too many args from empty Options"); | 75 debug("1.11 Remove too many args from empty Options"); |
| 76 shouldThrow("select1.options.remove(0, 'foo')"); | 76 shouldThrow("select1.options.remove(0, 'foo')"); |
| 77 shouldBe("select1.options.length", "0"); | 77 shouldBe("select1.options.length", "0"); |
| 78 shouldBe("select1.selectedIndex", "-1"); | 78 shouldBe("select1.selectedIndex", "-1"); |
| 79 debug(""); | 79 debug(""); |
| 80 | 80 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 debug("2.10 Remove (positive infinity) from non-empty Options"); | 188 debug("2.10 Remove (positive infinity) from non-empty Options"); |
| 189 value = 1/0; | 189 value = 1/0; |
| 190 shouldBe("select2.options.remove(value)", "undefined"); | 190 shouldBe("select2.options.remove(value)", "undefined"); |
| 191 shouldBe("select2.options.length", "6"); | 191 shouldBe("select2.options.length", "6"); |
| 192 shouldBe("select2.selectedIndex", "4"); | 192 shouldBe("select2.selectedIndex", "4"); |
| 193 shouldBe("select2.options[0].value", "'K'"); | 193 shouldBe("select2.options[0].value", "'K'"); |
| 194 debug(""); | 194 debug(""); |
| 195 | 195 |
| 196 debug("2.11 Remove no args from non-empty Options"); | 196 debug("2.11 Remove no args from non-empty Options"); |
| 197 shouldThrow("select2.options.remove()", "'TypeError: Not enough arguments'"); | 197 shouldThrow("select2.options.remove()", '"TypeError: Failed to execute \'remove\
' on \'HTMLOptionsCollection\': 1 argument required, but only 0 present."'); |
| 198 shouldBe("select2.options.length", "6"); | 198 shouldBe("select2.options.length", "6"); |
| 199 shouldBe("select2.selectedIndex", "4"); | 199 shouldBe("select2.selectedIndex", "4"); |
| 200 shouldBe("select2.options[0].value", "'K'"); | 200 shouldBe("select2.options[0].value", "'K'"); |
| 201 debug(""); | 201 debug(""); |
| 202 | 202 |
| 203 debug("2.12 Remove too many args from non-empty Options"); | 203 debug("2.12 Remove too many args from non-empty Options"); |
| 204 shouldThrow("select2.options.remove(0, 'foo')"); | 204 shouldThrow("select2.options.remove(0, 'foo')"); |
| 205 shouldBe("select2.options.length", "6"); | 205 shouldBe("select2.options.length", "6"); |
| 206 shouldBe("select2.selectedIndex", "4"); | 206 shouldBe("select2.selectedIndex", "4"); |
| 207 shouldBe("select2.options[0].value", "'K'"); | 207 shouldBe("select2.options[0].value", "'K'"); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 234 shouldBe("select2.selectedIndex", "2"); | 234 shouldBe("select2.selectedIndex", "2"); |
| 235 shouldBe("select2.options[1].value", "'N'"); | 235 shouldBe("select2.options[1].value", "'N'"); |
| 236 debug(""); | 236 debug(""); |
| 237 | 237 |
| 238 debug("2.17 Detach select element"); | 238 debug("2.17 Detach select element"); |
| 239 shouldNotBe("select2.parentNode", "null"); | 239 shouldNotBe("select2.parentNode", "null"); |
| 240 shouldBe("select2.remove()", "undefined"); | 240 shouldBe("select2.remove()", "undefined"); |
| 241 shouldBeNull("select2.parentNode"); | 241 shouldBeNull("select2.parentNode"); |
| 242 debug(""); | 242 debug(""); |
| 243 | 243 |
| OLD | NEW |