diff options
Diffstat (limited to 'js/event_target_test.ts')
-rw-r--r-- | js/event_target_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/event_target_test.ts b/js/event_target_test.ts index 71c872dab..aedbbf72a 100644 --- a/js/event_target_test.ts +++ b/js/event_target_test.ts @@ -92,3 +92,21 @@ test(function toStringShouldBeWebCompatibility() { const target = new EventTarget(); assertEquals(target.toString(), "[object EventTarget]"); }); + +test(function dispatchEventShouldNotThrowError() { + let hasThrown = false; + + try { + const target = new EventTarget(); + const event = new Event("hasOwnProperty", { + bubbles: true, + cancelable: false + }); + target.addEventListener("hasOwnProperty", () => {}); + target.dispatchEvent(event); + } catch { + hasThrown = true; + } + + assertEquals(hasThrown, false); +}); |