The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): cover the terminal overlay hiding on an unfocused tab switch
Brooklyn Nicholson7f3d2559312f
diff --git a/apps/desktop/src/app/right-sidebar/terminal/persistent.test.tsx b/apps/desktop/src/app/right-sidebar/terminal/persistent.test.tsxindex 5cf40b6ee64..ab4155823b2 100644--- a/apps/desktop/src/app/right-sidebar/terminal/persistent.test.tsx+++ b/apps/desktop/src/app/right-sidebar/terminal/persistent.test.tsx@@ -365,4 +365,41 @@ describe('PersistentTerminal rect tracking', () => {expect(overlay.style.pointerEvents).toBe('auto')expect(mount.container!.querySelector('[data-testid="terminal-workspace"]')).toBe(workspace)})++ it('hides the overlay on a tab switch that happens while the window is unfocused', () => {+ // The trap: the terminal is a tab in the main zone and the user clicks+ // another tab without the window being focused (or right as it blurs).+ // The rect chase is paused then — but visibility is correctness, not perf,+ // so the overlay must still stand down instead of covering the chat with+ // an opaque, pointer-interactive surface until something refocuses.+ installRaf()+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue(rect(10, 20, 200, 100))+ $terminalTakeover.set(true)++ mount.render(<HiddenPaneHarness hidden={false} />)++ const overlay = mount.container!.lastElementChild as HTMLElement++ expect(overlay.style.visibility).toBe('visible')+ expect(overlay.style.pointerEvents).toBe('auto')++ act(() => {+ vi.mocked(document.hasFocus).mockReturnValue(false)+ window.dispatchEvent(new Event('blur'))+ })++ act(() => {+ mount.root!.render(<HiddenPaneHarness hidden />)+ })++ act(() => {+ mutationObserverCallback?.([], {} as MutationObserver)+ })++ expect(overlay.style.visibility).toBe('hidden')+ expect(overlay.style.opacity).toBe('0')+ expect(overlay.style.pointerEvents).toBe('none')+ // The PTY survives — only the overlay stands down.+ expect(mount.container!.querySelector('[data-testid="terminal-workspace"]')).not.toBeNull()+ })})