diff options
author | Adam Conrad <422184+acconrad@users.noreply.github.com> | 2019-05-27 13:20:34 +0000 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-27 09:20:34 -0400 |
commit | 9fd4096235a308a0d405888ef808d6c665bef355 (patch) | |
tree | 428e808424f836975a5bf2ce68ccc9b75aa4e26e /js/event_target_test.ts | |
parent | 73ac5f89f022a3965c68705cef284386a9365419 (diff) |
add EventTarget implementation (#2377)
Diffstat (limited to 'js/event_target_test.ts')
-rw-r--r-- | js/event_target_test.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/js/event_target_test.ts b/js/event_target_test.ts index 6710b6e68..34c486b9f 100644 --- a/js/event_target_test.ts +++ b/js/event_target_test.ts @@ -14,10 +14,10 @@ test(function constructedEventTargetCanBeUsedAsExpected(): void { const event = new Event("foo", { bubbles: true, cancelable: false }); let callCount = 0; - function listener(e): void { + const listener = (e): void => { assertEquals(e, event); ++callCount; - } + }; target.addEventListener("foo", listener); @@ -47,9 +47,9 @@ test(function anEventTargetCanBeSubclassed(): void { new Event("foo", { bubbles: true, cancelable: false }); let callCount = 0; - function listener(): void { + const listener = (): void => { ++callCount; - } + }; target.on("foo", listener); assertEquals(callCount, 0); @@ -70,10 +70,10 @@ test(function constructedEventTargetUseObjectPrototype(): void { const event = new Event("toString", { bubbles: true, cancelable: false }); let callCount = 0; - function listener(e): void { + const listener = (e): void => { assertEquals(e, event); ++callCount; - } + }; target.addEventListener("toString", listener); @@ -102,7 +102,8 @@ test(function dispatchEventShouldNotThrowError(): void { bubbles: true, cancelable: false }); - target.addEventListener("hasOwnProperty", (): void => {}); + const listener = (): void => {}; + target.addEventListener("hasOwnProperty", listener); target.dispatchEvent(event); } catch { hasThrown = true; |