diff --git a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts index 4c94083ce64..d6f327a24df 100644 --- a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts +++ b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts @@ -187,6 +187,22 @@ describe('issue 21762: middle-click native-paste suppression in mouse-tracking T expect(pane.terminal.focus).not.toHaveBeenCalled() }) + // Guards against collapsing the modifier check to `shiftKey || altKey`: + // off Mac, xterm still forwards an Alt+middle-click, so the TUI pastes. + it('leaves Alt+middle-click on the TUI-owned path off Mac', () => { + const pane = buildTrackedPane('sgr') + const { result } = renderHook(() => useTerminalPaneMobileActions(buildController(pane))) + + const outcome = fireMiddleMouseDown( + result.current.handlePrimarySelectionMiddleMouseDown, + pane.container, + { altKey: true } + ) + + expect(outcome.propagationStopped).toBe(false) + expect(pane.terminal.focus).not.toHaveBeenCalled() + }) + it('stops auxclick propagation too, matching the mousedown handler', () => { const pane = buildTrackedPane('sgr') const { result } = renderHook(() => useTerminalPaneMobileActions(buildController(pane)))