wip
fix: docs
This commit is contained in:
@@ -69,6 +69,8 @@ describe('apply', () => {
|
||||
await vi.waitFor(() => { expect(slots.entries('conversation.input.overlay')).toHaveLength(1) })
|
||||
const entries = slots.entries('conversation.input.overlay')
|
||||
expect(entries[0]!.options.id).toBe('slash-menu')
|
||||
// Copy rides the standard locale seat, not the business face.
|
||||
expect(entries[0]!.locale).toBe('slash.menu')
|
||||
|
||||
const slash = ctx.get('slash') as SlashService
|
||||
// StoredEntry.inject is declaration-typed ((...args: never[]) shape);
|
||||
@@ -79,8 +81,6 @@ describe('apply', () => {
|
||||
(ctx.get('sessions') as { scope(id: SessionId): Context }).scope(sid('a')),
|
||||
)
|
||||
expect(injected.menu).toBe(controller.menu)
|
||||
// The injected translator is the menu-namespace binding.
|
||||
expect(injected.t('command')).toBe('命令')
|
||||
// The pick face routes into the controller pipeline (closed menu → no-op).
|
||||
injected.onPick('command', 0)
|
||||
expect(controller.menu.getSnapshot().open).toBe(false)
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user