Skip to content

The agent that grows with you

test(desktop): window focus policy calls isFocused as a method

alt-glitch237fba22e06c
diff --git a/apps/desktop/electron/window-focus-policy.test.ts b/apps/desktop/electron/window-focus-policy.test.ts
index 12e537d9dbf..e2860299f52 100644
--- a/apps/desktop/electron/window-focus-policy.test.ts
+++ b/apps/desktop/electron/window-focus-policy.test.ts
@@ -32,3 +32,17 @@ test('an already-focused window never pumps the OS foreground path', () => {
// runs SetForegroundWindow on Windows, dismissing another app's dialog.
assert.equal(shouldFocusToTakeKeyboard({ isFocused: () => true }), false)
})
+
+test('the policy calls isFocused as a method, the way BrowserWindow needs it', () => {
+ // BrowserWindow.isFocused reads its native handle from `this`; destructuring
+ // it threw "Object has been destroyed" and dropped every deep link.
+ class NativeLikeWindow {
+ private readonly focused = false
+
+ isFocused(): boolean {
+ return this.focused
+ }
+ }
+
+ assert.equal(shouldFocusToTakeKeyboard(new NativeLikeWindow()), true)
+})