test: consolidate duplicate terminal theme subscription cleanup (#29708)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-16 07:40:38 -07:00
committed by GitHub
co-authored by OrcaWin
parent 86aa232876
commit eada95e960
@@ -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