Files
opsxshell/test/utils/terminalPanes.test.ts
T
Logan.Li b0d0e3a5f3 feat(i18n): add multi-language support (ja/ko/vi/ru/zh-TW) with system auto-detection
- Extend AppLanguage to 7 locales: zh-CN, zh-TW, en, ja, ko, vi, ru
- Auto-detect system language via navigator.languages; fallback to English
- Add BCP47 locale mapping for date formatting and sorting
- Create 50 translation JSON files (5 languages × 10 namespaces, 1137 keys each)
- Update language selector with native language names
- Extend locale key parity test to cover all 7 languages (70 assertions)
- Add VNC/RDP desktop, serial terminal, AI agent, port forwarding, and SFTP features
- Add credential encryption, host metrics, session backup crypto, and zmodem bridge
- Update Rust backend: desktop services, host metrics, SSH/SFTP enhancements
2026-08-12 00:07:48 +08:00

37 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
resolveTerminalInputTargets,
shouldBroadcastTerminalInput,
} from '../../src/utils/terminalPanes'
const panes = [
{ id: 'left', shellId: 'shell-1' },
{ id: 'starting', shellId: null },
{ id: 'right', shellId: 'shell-3' },
]
describe('terminal pane input routing', () => {
it('routes normal input only to the source pane', () => {
expect(resolveTerminalInputTargets(panes, 'right', false)).toEqual(['shell-3'])
})
it('routes broadcast input to every ready shell in pane order', () => {
expect(resolveTerminalInputTargets(panes, 'left', true)).toEqual([
'shell-1',
'shell-3',
])
})
it('does not write when the source pane has no ready shell', () => {
expect(resolveTerminalInputTargets(panes, 'starting', false)).toEqual([])
expect(resolveTerminalInputTargets(panes, 'missing', false)).toEqual([])
})
it('broadcasts from both SSH and local terminals when enabled', () => {
expect(shouldBroadcastTerminalInput(true, true, 'local')).toBe(true)
expect(shouldBroadcastTerminalInput(true, false, 'ssh-connection')).toBe(true)
expect(shouldBroadcastTerminalInput(true, false, null)).toBe(false)
expect(shouldBroadcastTerminalInput(false, false, 'ssh-connection')).toBe(false)
})
})