| OLD | NEW |
| 1 function runTestsShouldPass(tagName, attributes) | 1 function runTestsShouldPass(tagName, attributes) |
| 2 { | 2 { |
| 3 attributes = attributes || {}; | 3 attributes = attributes || {}; |
| 4 window.element = document.createElement(tagName); | 4 window.element = document.createElement(tagName); |
| 5 for (var key in attributes) | 5 for (var key in attributes) |
| 6 element.setAttribute(key, attributes[key]); | 6 element.setAttribute(key, attributes[key]); |
| 7 document.body.appendChild(element); | 7 document.body.appendChild(element); |
| 8 debug("<hr>"); | 8 debug("<hr>"); |
| 9 debug("Running tests on " + tagName + " with attributes: " + JSON.stringify(
attributes) + "\n"); | 9 debug("Running tests on " + tagName + " with attributes: " + JSON.stringify(
attributes) + "\n"); |
| 10 debug("setRangeText() with only one parameter."); | 10 debug("setRangeText() with only one parameter."); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 debug("\nsetRangeText() with 'preserve' as the selectMode."); | 76 debug("\nsetRangeText() with 'preserve' as the selectMode."); |
| 77 evalAndLog("element.value = '0123456789'"); | 77 evalAndLog("element.value = '0123456789'"); |
| 78 evalAndLog("element.setSelectionRange(6, 9)"); | 78 evalAndLog("element.setSelectionRange(6, 9)"); |
| 79 evalAndLog("element.setRangeText('A', 1, 2)"); // selectMode is optional and
defaults to preserve. | 79 evalAndLog("element.setRangeText('A', 1, 2)"); // selectMode is optional and
defaults to preserve. |
| 80 shouldBeEqualToString("element.value", "0A23456789"); | 80 shouldBeEqualToString("element.value", "0A23456789"); |
| 81 shouldBe("element.selectionStart", "6"); | 81 shouldBe("element.selectionStart", "6"); |
| 82 shouldBe("element.selectionEnd", "9"); | 82 shouldBe("element.selectionEnd", "9"); |
| 83 | 83 |
| 84 evalAndLog("element.value = '0123456789'"); | 84 evalAndLog("element.value = '0123456789'"); |
| 85 evalAndLog("element.setSelectionRange(6, 9)"); | 85 evalAndLog("element.setSelectionRange(6, 9)"); |
| 86 evalAndLog("element.setRangeText('AB', 1, 1, 'invalid')"); // Invalid select
Mode values default to preserve. | 86 shouldThrow("element.setRangeText('AB', 1, 1, 'invalid')"); // Invalid selec
tMode should throw TypeError |
| 87 shouldBeEqualToString("element.value", "0AB123456789"); | 87 shouldBeEqualToString("element.value", "0123456789"); |
| 88 shouldBe("element.selectionStart", "8"); | 88 shouldBe("element.selectionStart", "6"); |
| 89 shouldBe("element.selectionEnd", "11"); | 89 shouldBe("element.selectionEnd", "9"); |
| 90 | 90 |
| 91 evalAndLog("element.value = '0123456789'"); | 91 evalAndLog("element.value = '0123456789'"); |
| 92 evalAndLog("element.setSelectionRange(6, 9)"); | 92 evalAndLog("element.setSelectionRange(6, 9)"); |
| 93 evalAndLog("element.setRangeText('AB', 1, 1, undefined)"); // Undefined sele
ctMode also default to preserve. | 93 evalAndLog("element.setRangeText('AB', 1, 1, undefined)"); // Undefined sele
ctMode also default to preserve. |
| 94 shouldBeEqualToString("element.value", "0AB123456789"); | 94 shouldBeEqualToString("element.value", "0AB123456789"); |
| 95 shouldBe("element.selectionStart", "8"); | 95 shouldBe("element.selectionStart", "8"); |
| 96 shouldBe("element.selectionEnd", "11"); | 96 shouldBe("element.selectionEnd", "11"); |
| 97 | 97 |
| 98 evalAndLog("element.value = '0123456789'"); | 98 evalAndLog("element.value = '0123456789'"); |
| 99 evalAndLog("element.setSelectionRange(6, 9)"); | 99 evalAndLog("element.setSelectionRange(6, 9)"); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 shouldThrow("element.value = '0123456789XYZ'"); | 156 shouldThrow("element.value = '0123456789XYZ'"); |
| 157 else | 157 else |
| 158 evalAndLog("element.value = '0123456789XYZ'"); | 158 evalAndLog("element.value = '0123456789XYZ'"); |
| 159 var initialValue = element.value; | 159 var initialValue = element.value; |
| 160 shouldThrow("element.setRangeText('ABC', 0, 0)"); | 160 shouldThrow("element.setRangeText('ABC', 0, 0)"); |
| 161 // setRangeText() shouldn't do anything on non-text form controls. | 161 // setRangeText() shouldn't do anything on non-text form controls. |
| 162 shouldBeEqualToString("element.value", initialValue); | 162 shouldBeEqualToString("element.value", initialValue); |
| 163 } | 163 } |
| 164 | 164 |
| 165 | 165 |
| OLD | NEW |