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
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* HostKeyDialog — first-connect / changed-key confirmation
|
||||
*/
|
||||
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import HostKeyDialog from '../../src/components/terminal/HostKeyDialog'
|
||||
|
||||
describe('HostKeyDialog', () => {
|
||||
it('emits accept-always for a new host key', async () => {
|
||||
const user = userEvent.setup()
|
||||
const onDecision = vi.fn()
|
||||
render(
|
||||
<HostKeyDialog
|
||||
open
|
||||
host="ops.example.com"
|
||||
port={22}
|
||||
keyType="ssh-ed25519"
|
||||
fingerprint="AAAA"
|
||||
isChanged={false}
|
||||
onDecision={onDecision}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(screen.getByText('确认主机密钥')).toBeVisible()
|
||||
await user.click(screen.getByRole('button', { name: '始终信任' }))
|
||||
expect(onDecision).toHaveBeenCalledWith('accept-always')
|
||||
})
|
||||
|
||||
it('shows previous fingerprint when the key changed', async () => {
|
||||
const user = userEvent.setup()
|
||||
const onDecision = vi.fn()
|
||||
render(
|
||||
<HostKeyDialog
|
||||
open
|
||||
host="ops.example.com"
|
||||
port={2222}
|
||||
keyType="ssh-rsa"
|
||||
fingerprint="NEW"
|
||||
isChanged
|
||||
previousFingerprint="OLD"
|
||||
onDecision={onDecision}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(screen.getByText('主机密钥已变更')).toBeVisible()
|
||||
expect(screen.getByText(/SHA256:OLD/)).toBeVisible()
|
||||
await user.click(screen.getByRole('button', { name: '仍要信任并更新' }))
|
||||
expect(onDecision).toHaveBeenCalledWith('accept-always')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user