| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <script> | |
| 8 | |
| 9 description("This tests the constructor for the AutocompleteErrorEvent DOM class
."); | |
| 10 | |
| 11 if (!window.AutocompleteErrorEvent) { | |
| 12 testFailed('no AutocompleteErrorEvent'); | |
| 13 finishJSTest(); | |
| 14 } else { | |
| 15 // No initializer is passed. | |
| 16 shouldBe("new AutocompleteErrorEvent('eventType').bubbles", "false"); | |
| 17 shouldBe("new AutocompleteErrorEvent('eventType').cancelable", "false"); | |
| 18 shouldBeEqualToString("new AutocompleteErrorEvent('eventType').reason", ""); | |
| 19 | |
| 20 // bubbles is passed. | |
| 21 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: false }).bubble
s", "false"); | |
| 22 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true }).bubbles
", "true"); | |
| 23 | |
| 24 // cancelable is passed. | |
| 25 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: false }).can
celable", "false"); | |
| 26 shouldBe("new AutocompleteErrorEvent('eventType', { cancelable: true }).canc
elable", "true"); | |
| 27 | |
| 28 // reason is passed. | |
| 29 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'ca
ncel' }).reason", "cancel"); | |
| 30 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: ''
}).reason", ""); | |
| 31 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'di
sabled' }).reason", "disabled"); | |
| 32 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: 'in
valid' }).reason", "invalid"); | |
| 33 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { reason: und
efined }).reason", ""); | |
| 34 | |
| 35 // Invalid reason throws exception | |
| 36 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 'doremi' })")
; | |
| 37 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: null })"); | |
| 38 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: false })"); | |
| 39 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: true })"); | |
| 40 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: 12345 })"); | |
| 41 shouldThrow("new AutocompleteErrorEvent('eventType', { reason: NaN })"); | |
| 42 | |
| 43 // All initializers are passed. | |
| 44 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: '' }).bubbles", "true"); | |
| 45 shouldBe("new AutocompleteErrorEvent('eventType', { bubbles: true, cancelabl
e: true, reason: 'cancel' }).cancelable", "true"); | |
| 46 shouldBeEqualToString("new AutocompleteErrorEvent('eventType', { bubbles: tr
ue, cancelable: true, reason: 'disabled' }).reason", "disabled"); | |
| 47 } | |
| 48 | |
| 49 </script> | |
| 50 </body> | |
| 51 </html> | |
| OLD | NEW |