| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 shouldBe("select1.options.remove()", "undefined"); | 70 shouldBe("select1.options.remove()", "undefined"); |
| 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 shouldBe("select1.options.remove(0, 'foo')", "undefined"); | 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 |
| 81 debug("1.12 Remove invalid index -2 from empty Options"); | 81 debug("1.12 Remove invalid index -2 from empty Options"); |
| 82 shouldBe("select1.options.remove(-2)", "undefined"); | 82 shouldBe("select1.options.remove(-2)", "undefined"); |
| 83 shouldBe("select1.options.length", "0"); | 83 shouldBe("select1.options.length", "0"); |
| 84 shouldBe("select1.selectedIndex", "-1"); | 84 shouldBe("select1.selectedIndex", "-1"); |
| 85 debug(""); | 85 debug(""); |
| 86 | 86 |
| 87 debug("1.13 Remove invalid index -1 from empty Options"); | 87 debug("1.13 Remove invalid index -1 from empty Options"); |
| 88 shouldBe("select1.options.remove(-1)", "undefined"); | 88 shouldBe("select1.options.remove(-1)", "undefined"); |
| 89 shouldBe("select1.options.length", "0"); | 89 shouldBe("select1.options.length", "0"); |
| 90 shouldBe("select1.selectedIndex", "-1"); | 90 shouldBe("select1.selectedIndex", "-1"); |
| 91 debug(""); | 91 debug(""); |
| 92 | 92 |
| 93 debug("1.14 Remove index 0 from empty Options"); | 93 debug("1.14 Remove index 0 from empty Options"); |
| 94 shouldBe("select1.options.remove(0)", "undefined"); | 94 shouldBe("select1.options.remove(0)", "undefined"); |
| 95 shouldBe("select1.options.length", "0"); | 95 shouldBe("select1.options.length", "0"); |
| 96 shouldBe("select1.selectedIndex", "-1"); | 96 shouldBe("select1.selectedIndex", "-1"); |
| 97 debug(""); | 97 debug(""); |
| 98 | 98 |
| 99 debug("1.15 Remove index 1 from empty Options"); | 99 debug("1.15 Remove index 1 from empty Options"); |
| 100 shouldBe("select1.options.remove(1)", "undefined"); | 100 shouldBe("select1.options.remove(1)", "undefined"); |
| 101 shouldBe("select1.options.length", "0"); | 101 shouldBe("select1.options.length", "0"); |
| 102 shouldBe("select1.selectedIndex", "-1"); | 102 shouldBe("select1.selectedIndex", "-1"); |
| 103 debug(""); | 103 debug(""); |
| 104 | 104 |
| 105 debug("1.16 Detach select element"); |
| 106 shouldNotBe("select1.parentNode", "null"); |
| 107 shouldBe("select1.remove()", "undefined"); |
| 108 shouldBeNull("select1.parentNode"); |
| 109 debug(""); |
| 110 |
| 105 // ------------------------------------------------ | 111 // ------------------------------------------------ |
| 106 | 112 |
| 107 i = 0; | 113 i = 0; |
| 108 var select2 = document.getElementById("select2"); | 114 var select2 = document.getElementById("select2"); |
| 109 | 115 |
| 110 debug("2.1 Remove (object) from non-empty Options"); | 116 debug("2.1 Remove (object) from non-empty Options"); |
| 111 value = document.createElement("DIV"); | 117 value = document.createElement("DIV"); |
| 112 shouldBe("select2.options.remove(value)", "undefined"); | 118 shouldBe("select2.options.remove(value)", "undefined"); |
| 113 shouldBe("select2.options.length", "15"); | 119 shouldBe("select2.options.length", "15"); |
| 114 shouldBe("select2.selectedIndex", "13"); | 120 shouldBe("select2.selectedIndex", "13"); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 debug(""); | 194 debug(""); |
| 189 | 195 |
| 190 debug("2.11 Remove no args from non-empty Options"); | 196 debug("2.11 Remove no args from non-empty Options"); |
| 191 shouldBe("select2.options.remove()", "undefined"); | 197 shouldBe("select2.options.remove()", "undefined"); |
| 192 shouldBe("select2.options.length", "5"); | 198 shouldBe("select2.options.length", "5"); |
| 193 shouldBe("select2.selectedIndex", "3"); | 199 shouldBe("select2.selectedIndex", "3"); |
| 194 shouldBe("select2.options[0].value", "'L'"); | 200 shouldBe("select2.options[0].value", "'L'"); |
| 195 debug(""); | 201 debug(""); |
| 196 | 202 |
| 197 debug("2.12 Remove too many args from non-empty Options"); | 203 debug("2.12 Remove too many args from non-empty Options"); |
| 198 shouldBe("select2.options.remove(0, 'foo')", "undefined"); | 204 shouldThrow("select2.options.remove(0, 'foo')"); |
| 205 shouldBe("select2.options.length", "5"); |
| 206 shouldBe("select2.selectedIndex", "3"); |
| 207 shouldBe("select2.options[0].value", "'L'"); |
| 208 debug(""); |
| 209 |
| 210 debug("2.13 Remove invalid index -2 from non-empty Options"); |
| 211 shouldBe("select2.options.remove(-2)", "undefined"); |
| 212 shouldBe("select2.options.length", "5"); |
| 213 shouldBe("select2.selectedIndex", "3"); |
| 214 shouldBe("select2.options[2].value", "'N'"); |
| 215 debug(""); |
| 216 |
| 217 debug("2.14 Remove invalid index -1 from non-empty Options"); |
| 218 shouldBe("select2.options.remove(-1)", "undefined"); |
| 219 shouldBe("select2.options.length", "5"); |
| 220 shouldBe("select2.selectedIndex", "3"); |
| 221 shouldBe("select2.options[3].value", "'O'"); |
| 222 debug(""); |
| 223 |
| 224 debug("2.15 Remove index 0 from non-empty Options"); |
| 225 shouldBe("select2.options.remove(0)", "undefined"); |
| 199 shouldBe("select2.options.length", "4"); | 226 shouldBe("select2.options.length", "4"); |
| 200 shouldBe("select2.selectedIndex", "2"); | 227 shouldBe("select2.selectedIndex", "2"); |
| 201 shouldBe("select2.options[0].value", "'M'"); | 228 shouldBe("select2.options[0].value", "'M'"); |
| 202 debug(""); | 229 debug(""); |
| 203 | 230 |
| 204 debug("2.13 Remove invalid index -2 from non-empty Options"); | 231 debug("2.16 Remove index 1 from non-empty Options"); |
| 205 shouldBe("select2.options.remove(-2)", "undefined"); | 232 shouldBe("select2.options.remove(1)", "undefined"); |
| 206 shouldBe("select2.options.length", "4"); | 233 shouldBe("select2.options.length", "3"); |
| 207 shouldBe("select2.selectedIndex", "2"); | 234 shouldBe("select2.selectedIndex", "1"); |
| 208 shouldBe("select2.options[2].value", "'O'"); | 235 shouldBe("select2.options[1].value", "'O'"); |
| 209 debug(""); | 236 debug(""); |
| 210 | 237 |
| 211 debug("2.14 Remove invalid index -1 from non-empty Options"); | 238 debug("2.17 Detach select element"); |
| 212 shouldBe("select2.options.remove(-1)", "undefined"); | 239 shouldNotBe("select2.parentNode", "null"); |
| 213 shouldBe("select2.options.length", "4"); | 240 shouldBe("select2.remove()", "undefined"); |
| 214 shouldBe("select2.selectedIndex", "2"); | 241 shouldBeNull("select2.parentNode"); |
| 215 shouldBe("select2.options[3].value", "'P'"); | |
| 216 debug(""); | 242 debug(""); |
| 217 | 243 |
| 218 debug("2.15 Remove index 0 from non-empty Options"); | |
| 219 shouldBe("select2.options.remove(0)", "undefined"); | |
| 220 shouldBe("select2.options.length", "3"); | |
| 221 shouldBe("select2.selectedIndex", "1"); | |
| 222 shouldBe("select2.options[0].value", "'N'"); | |
| 223 debug(""); | |
| 224 | |
| 225 debug("2.16 Remove index 1 from non-empty Options"); | |
| 226 shouldBe("select2.options.remove(1)", "undefined"); | |
| 227 shouldBe("select2.options.length", "2"); | |
| 228 shouldBe("select2.selectedIndex", "0"); | |
| 229 shouldBe("select2.options[1].value", "'P'"); | |
| 230 debug(""); | |
| OLD | NEW |