Files
deepseek-harness/packages/test-support/client-runtime/tests/context-menu.client.spec.tsx
T
zhc a5f1d4a16a refactor(client): bind context menus at their Slot consumers
Merge master and preserve pinned-row visibility. Remove redundant Chat and tool-tree menu forwarding, unify trigger names, and bind file targets at the consuming Slot. Address CI static and coverage gaps without changing upstream scroll assertions.
2026-10-28 19:15:45 +08:00

21 lines
947 B
TypeScript

// @vitest-environment jsdom
/** Direct component fixtures fail loudly when an unstubbed menu is activated. */
import { afterEach, expect, it, vi } from 'vitest'
import { cleanup, fireEvent, render } from '@testing-library/react'
import { SessionId } from '@deepseek-ai/dsh-session/types'
import { contextMenuHook } from '../src/context-menu.ts'
afterEach(cleanup)
it('requires an activation observer when a fixture opens a menu', () => {
const { getTriggerProps } = contextMenuHook()()
const contextMenuProps = getTriggerProps({ kind: 'file', value: { sessionId: SessionId('fixture'), path: '/file' } })
const observed = vi.fn()
const view = render(<button onContextMenu={(event) => {
expect(() => contextMenuProps.onContextMenu?.(event)).toThrow('Unexpected context menu')
observed()
}}>File</button>)
fireEvent.contextMenu(view.getByRole('button'), { clientX: 1, clientY: 2 })
expect(observed).toHaveBeenCalledOnce()
})