From 4dca3b17160a9cad36380c6728415971445e3402 Mon Sep 17 00:00:00 2001 From: jankuss Date: Sun, 13 Dec 2020 14:16:09 -0800 Subject: [PATCH] Fix test --- src/objects/hitdetection/HitDetection.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/objects/hitdetection/HitDetection.test.ts b/src/objects/hitdetection/HitDetection.test.ts index 5cd2661f..4f101f64 100644 --- a/src/objects/hitdetection/HitDetection.test.ts +++ b/src/objects/hitdetection/HitDetection.test.ts @@ -1,8 +1,13 @@ import { HitDetection } from "./HitDetection"; +const view = { + getBoundingClientRect: () => ({ x: 0, y: 0 }), + addEventListener: () => {}, +}; + test("detects hits on multiple elements", () => { const hitDetection = new HitDetection({ - view: { getBoundingClientRect: () => ({ x: 0, y: 0 }) }, + view, } as any); let firstClicked = false; @@ -32,7 +37,7 @@ test("detects hits on multiple elements", () => { test("doesn't detect if element out of bounds", () => { const hitDetection = new HitDetection({ - view: { getBoundingClientRect: () => ({ x: 0, y: 0 }) }, + view, } as any); let firstClicked = false; @@ -62,7 +67,7 @@ test("doesn't detect if element out of bounds", () => { test("doesn't detect if element in bounds but doesn't hit", () => { const hitDetection = new HitDetection({ - view: { getBoundingClientRect: () => ({ x: 0, y: 0 }) }, + view, } as any); let firstClicked = false; @@ -92,7 +97,7 @@ test("doesn't detect if element in bounds but doesn't hit", () => { test("intercepts event if element stops propagating", () => { const hitDetection = new HitDetection({ - view: { getBoundingClientRect: () => ({ x: 0, y: 0 }) }, + view, } as any); let firstClicked = false;