OLD | NEW |
1 description("Tests the properties of the exception thrown by dispatchEvent.") | 1 description("Tests that dispatchEvent's argument is required to be an Event.") |
2 | 2 |
3 var e; | 3 shouldThrow("document.dispatchEvent(null)"); |
4 try { | 4 shouldThrow("document.dispatchEvent(document)"); |
5 document.dispatchEvent(null); | |
6 // raises a InvalidStateError | |
7 } catch (err) { | |
8 e = err; | |
9 } | |
10 | |
11 shouldBeEqualToString("e.toString()", "InvalidStateError: Failed to execute 'dis
patchEvent' on 'EventTarget': The event provided is null."); | |
12 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException
]"); | |
13 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DO
MExceptionPrototype]"); | |
14 shouldBeEqualToString("e.constructor.toString()", "function DOMException() { [na
tive code] }"); | |
15 shouldBe("e.constructor", "window.DOMException"); | |
16 | |
OLD | NEW |