fix: docs
This commit is contained in:
imccyu
2026-07-30 15:56:41 +08:00
parent 085383b145
commit 1e10966ef6
160 changed files with 2521 additions and 1135 deletions

View File

@@ -10,6 +10,9 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import { createSnapshotStore } from '@deepseek-ai/dsh-client-runtime/client'
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
import { zh } from '../src/client/locales.ts'
import type { MenuState, TriggerHit } from '@deepseek-ai/dsh-client-ui-slash/client'
import { MenuView } from '../src/client/MenuView.tsx'
@@ -48,10 +51,10 @@ afterEach(() => {
vi.restoreAllMocks()
})
// Dictionary-backed fake mirroring the LocaleService key fallback (an
// unknown key comes back verbatim, so unknown sources show their raw name).
const DICT: Record<string, string> = { command: 'Commands', skill: 'Skills', loading: 'Loading…' }
const t = (key: string) => DICT[key] ?? key
// The framework-injected t seat, stubbed over the zh dictionaries (the
// default locale); the stub mirrors the LocaleService key fallback, so an
// unknown source comes back verbatim (its raw name).
const t = makeTranslate(zh, commonZh)
function mount(state: MenuState) {
const menu = createSnapshotStore<MenuState>(state)
@@ -81,7 +84,7 @@ describe('MenuView', () => {
mount(openState())
const options = screen.getAllByRole('option')
expect(options.map(o => o.textContent)).toEqual(['⚑goalSet up a goal', 'plan'])
expect(screen.queryByText('Loading…')).not.toBeNull()
expect(screen.queryByText('正在加载…')).not.toBeNull()
})
it('titles each group with the localized source name, raw name for unknown sources, none for empty ready groups', () => {
@@ -93,7 +96,7 @@ describe('MenuView', () => {
{ source: 'skill', status: 'pending', items: [] },
],
}))
expect(titles(view.container)).toEqual(['Commands', 'mystery', 'Skills'])
expect(titles(view.container)).toEqual(['命令', 'mystery', '技能'])
})
it('exposes the highlight via aria-activedescendant and aria-selected', () => {