aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/unit/overlay.test.mjs7
1 files changed, 6 insertions, 1 deletions
diff --git a/test-suite/unit/overlay.test.mjs b/test-suite/unit/overlay.test.mjs
index cd60522..a4247b3 100644
--- a/test-suite/unit/overlay.test.mjs
+++ b/test-suite/unit/overlay.test.mjs
@@ -71,9 +71,13 @@ test("the injected clean-up removes foreign extension iframes, not ours, and blu
const shadowFrame = mk("chrome-extension://aeblf/inline/b.html");
const host = { tagName: "DIV", shadowRoot: { querySelectorAll: () => [shadowFrame] } };
let blurred = false, escaped = false;
+ const bodyEvents = [];
const sandbox = {
- document: { querySelectorAll: () => [foreign, ours, page, host], activeElement: { blur: () => { blurred = true; } }, body: {}, dispatchEvent: (e) => { escaped = e.key === "Escape"; } },
+ document: { querySelectorAll: () => [foreign, ours, page, host], activeElement: { blur: () => { blurred = true; } }, body: { dispatchEvent: (e) => { bodyEvents.push(e.type); } }, dispatchEvent: (e) => { escaped = e.key === "Escape"; } },
KeyboardEvent: class { constructor(type, init) { this.type = type; Object.assign(this, init); } },
+ MouseEvent: class { constructor(type) { this.type = type; } },
+ PointerEvent: class { constructor(type) { this.type = type; } },
+ window: {},
Array,
};
const result = vm.runInNewContext(`(${w.clearForeignOverlays.toString()})("ours")`, sandbox);
@@ -81,6 +85,7 @@ test("the injected clean-up removes foreign extension iframes, not ours, and blu
assert.equal(foreign.removed && shadowFrame.removed, true);
assert.equal(ours.removed || page.removed, false);
assert.ok(blurred && escaped);
+ assert.deepEqual([...bodyEvents], ["pointerdown", "mousedown", "pointerup", "mouseup", "click"]);
});
test("the tool and the primer let the agent decide: clear it when in the way, leave it when waiting for the user", () => {