diff options
Diffstat (limited to 'js/timers_test.ts')
-rw-r--r-- | js/timers_test.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/timers_test.ts b/js/timers_test.ts index 7769be010..cbdc6eaba 100644 --- a/js/timers_test.ts +++ b/js/timers_test.ts @@ -165,3 +165,15 @@ test(async function fireCallbackImmediatelyWhenDelayOverMaxValue(): Promise< await waitForMs(1); assertEquals(count, 1); }); + +test(async function timeoutCallbackThis(): Promise<void> { + const { promise, resolve } = deferred(); + const obj = { + foo(): void { + assertEquals(this, window); + resolve(); + } + }; + setTimeout(obj.foo, 1); + await promise; +}); |