feat: add terminal broadcast, context menu, and shell close
Complete multi-pane broadcast, standard terminal right-click actions, batch host selection with progress, and native ssh_close_shell so closing a pane tears down the remote shell. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
494ef6b9d0
commit
9ce71795b8
38 files changed
+1437
-186
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
getTerminalBroadcastTargets,
|
||||
terminalBroadcastTargetCount,
|
||||
useTerminalBroadcastStore,
|
||||
} from '../../src/stores/terminalBroadcastStore'
|
||||
|
||||
describe('terminal broadcast store', () => {
|
||||
beforeEach(() => useTerminalBroadcastStore.getState().reset())
|
||||
|
||||
it('collects ready shells from every open terminal workspace and removes closed tabs', () => {
|
||||
const store = useTerminalBroadcastStore.getState()
|
||||
store.registerWorkspace({
|
||||
tabId: 'tab-a',
|
||||
targets: [
|
||||
{ tabId: 'tab-a', paneId: 'left', shellId: 'shell-a', connectionId: 'conn-a', label: 'Host A' },
|
||||
{ tabId: 'tab-a', paneId: 'right', shellId: 'shell-b', connectionId: 'conn-a', label: 'Host A' },
|
||||
],
|
||||
})
|
||||
store.registerWorkspace({
|
||||
tabId: 'tab-b',
|
||||
targets: [
|
||||
{ tabId: 'tab-b', paneId: 'main', shellId: 'shell-c', connectionId: 'conn-b', label: 'Host B' },
|
||||
],
|
||||
})
|
||||
|
||||
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual([
|
||||
'shell-a',
|
||||
'shell-b',
|
||||
'shell-c',
|
||||
])
|
||||
expect(terminalBroadcastTargetCount(useTerminalBroadcastStore.getState())).toBe(3)
|
||||
|
||||
useTerminalBroadcastStore.getState().unregisterWorkspace('tab-a')
|
||||
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual(['shell-c'])
|
||||
})
|
||||
|
||||
it('deduplicates a shell defensively', () => {
|
||||
useTerminalBroadcastStore.getState().registerWorkspace({
|
||||
tabId: 'tab-a',
|
||||
targets: [
|
||||
{ tabId: 'tab-a', paneId: 'a', shellId: 'shared', connectionId: 'conn-a', label: 'A' },
|
||||
{ tabId: 'tab-a', paneId: 'b', shellId: 'shared', connectionId: 'conn-a', label: 'A' },
|
||||
],
|
||||
})
|
||||
expect(getTerminalBroadcastTargets()).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user