From eada95e96059c57a567ae2f19959d6beae6975e9 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Fri, 16 Oct 2026 07:40:38 -0700 Subject: [PATCH] test: consolidate duplicate terminal theme subscription cleanup (#29708) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../pty-connection-mode-2031-subscriptions.spec.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/renderer/src/components/terminal-pane/pty-connection-mode-2031-subscriptions.spec.ts b/src/renderer/src/components/terminal-pane/pty-connection-mode-2031-subscriptions.spec.ts index f9f72078752..9905d8cbfc4 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-mode-2031-subscriptions.spec.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-mode-2031-subscriptions.spec.ts @@ -95,8 +95,10 @@ export function registerPtyConnectionMode2031SubscriptionsTests(): void { // Two separate PTY chunks. xterm would parse both in one batch and see only the net result. emit('\x1b[?2031h') expect(deps.paneMode2031Ref.current.get(1)).toBe(true) + expect(deps.paneLastThemeModeRef.current.get(1)).toBe('light') emit('\x1b[?2031l') expect(deps.paneMode2031Ref.current.get(1)).toBeUndefined() + expect(deps.paneLastThemeModeRef.current.get(1)).toBeUndefined() expect(replies(transport)).toEqual([]) dispose() }) @@ -185,18 +187,6 @@ export function registerPtyConnectionMode2031SubscriptionsTests(): void { dispose() }) - it('drops a live subscription when a later chunk withdraws it', async () => { - const { deps, emit, dispose } = await connectVisiblePane() - // A TUI that exits: the earlier chunk really did register, so the withdrawal has - // state to undo — otherwise a theme flip pushes CSI 997 at the shell that replaced it. - emit('\x1b[?2031h') - expect(deps.paneMode2031Ref.current.get(1)).toBe(true) - emit('\x1b[?2031l') - expect(deps.paneMode2031Ref.current.get(1)).toBeUndefined() - expect(deps.paneLastThemeModeRef.current.get(1)).toBeUndefined() - dispose() - }) - it('discards a half-read escape prefix when the pane swaps PTYs', async () => { const { transport, deps, emit, dispose } = await connectVisiblePane() // Why: the tail is a byte range from the old stream. Splicing it onto the first