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
This commit is contained in:
1 parent
fea6d8db04
commit
b0d0e3a5f3
301 files changed
+28002
-2705
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
getTerminalBroadcastTargets,
|
||||
selectBroadcastTargetCount,
|
||||
terminalBroadcastTargetCount,
|
||||
useTerminalBroadcastStore,
|
||||
} from '../../src/stores/terminalBroadcastStore'
|
||||
@@ -8,7 +9,40 @@ import {
|
||||
describe('terminal broadcast store', () => {
|
||||
beforeEach(() => useTerminalBroadcastStore.getState().reset())
|
||||
|
||||
it('collects ready shells from every open terminal workspace and removes closed tabs', () => {
|
||||
it('defaults scope to current-tab', () => {
|
||||
expect(useTerminalBroadcastStore.getState().scope).toBe('current-tab')
|
||||
})
|
||||
|
||||
it('collects ready shells from every open terminal workspace when scope is all', () => {
|
||||
const store = useTerminalBroadcastStore.getState()
|
||||
store.setScope('all')
|
||||
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: 'local', label: 'Local' },
|
||||
],
|
||||
})
|
||||
|
||||
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual([
|
||||
'shell-a',
|
||||
'shell-b',
|
||||
'shell-c',
|
||||
])
|
||||
expect(terminalBroadcastTargetCount(useTerminalBroadcastStore.getState())).toBe(3)
|
||||
expect(selectBroadcastTargetCount('tab-a')(useTerminalBroadcastStore.getState())).toBe(3)
|
||||
|
||||
useTerminalBroadcastStore.getState().unregisterWorkspace('tab-a')
|
||||
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual(['shell-c'])
|
||||
})
|
||||
|
||||
it('limits targets to the source tab when scope is current-tab', () => {
|
||||
const store = useTerminalBroadcastStore.getState()
|
||||
store.registerWorkspace({
|
||||
tabId: 'tab-a',
|
||||
@@ -24,15 +58,13 @@ describe('terminal broadcast store', () => {
|
||||
],
|
||||
})
|
||||
|
||||
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'])
|
||||
expect(getTerminalBroadcastTargets('tab-a').map((t) => t.shellId)).toEqual(['shell-a', 'shell-b'])
|
||||
expect(getTerminalBroadcastTargets('tab-b').map((t) => t.shellId)).toEqual(['shell-c'])
|
||||
const latest = useTerminalBroadcastStore.getState()
|
||||
expect(selectBroadcastTargetCount('tab-a')(latest)).toBe(2)
|
||||
expect(selectBroadcastTargetCount('tab-b')(latest)).toBe(1)
|
||||
// Without source tab id, current-tab must not silently expand to all tabs
|
||||
expect(getTerminalBroadcastTargets()).toEqual([])
|
||||
})
|
||||
|
||||
it('deduplicates a shell defensively', () => {
|
||||
@@ -43,6 +75,6 @@ describe('terminal broadcast store', () => {
|
||||
{ tabId: 'tab-a', paneId: 'b', shellId: 'shared', connectionId: 'conn-a', label: 'A' },
|
||||
],
|
||||
})
|
||||
expect(getTerminalBroadcastTargets()).toHaveLength(1)
|
||||
expect(getTerminalBroadcastTargets('tab-a')).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user