Green the jsdom lane for the composer-seat ResizeObserver and new StatsLine format
The seat's height publisher needs a ResizeObserver stub in every spec that renders ConversationRoot (jsdom has none), and the two branch-tail StatsLine assertions move to the grouped detail-row output.
This commit is contained in:
@@ -29,9 +29,20 @@ import { apply, inject } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|||||||
|
|
||||||
const SID = 's1' as SessionId
|
const SID = 's1' as SessionId
|
||||||
|
|
||||||
afterEach(cleanup)
|
/** jsdom has no ResizeObserver; the composer seat publishes its height through one. */
|
||||||
|
class ResizeObserverStub {
|
||||||
|
observe(): void {}
|
||||||
|
unobserve(): void {}
|
||||||
|
disconnect(): void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.unstubAllGlobals()
|
||||||
|
})
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
|
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
|
||||||
})
|
})
|
||||||
|
|
||||||
const TODOS: TodoItem[] = [
|
const TODOS: TodoItem[] = [
|
||||||
|
|||||||
@@ -216,6 +216,6 @@ describe('small branch tails', () => {
|
|||||||
const view = render(
|
const view = render(
|
||||||
<StatsLine useSession={bindSnapshotSelector(source) as unknown as StatsLineProps['useSession']} />,
|
<StatsLine useSession={bindSnapshotSelector(source) as unknown as StatsLineProps['useSession']} />,
|
||||||
)
|
)
|
||||||
expect(view.getByText('10 tokens · 1 turns · 1 steps')).toBeTruthy()
|
expect(view.container.textContent).toBe('1 turns · 1 steps|Input 0 tok · Output 10 tok')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,9 +23,20 @@ import { apply, inject } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|||||||
|
|
||||||
const SID = 's1' as SessionId
|
const SID = 's1' as SessionId
|
||||||
|
|
||||||
afterEach(cleanup)
|
/** jsdom has no ResizeObserver; the composer seat publishes its height through one. */
|
||||||
|
class ResizeObserverStub {
|
||||||
|
observe(): void {}
|
||||||
|
unobserve(): void {}
|
||||||
|
disconnect(): void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.unstubAllGlobals()
|
||||||
|
})
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
|
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
|
||||||
})
|
})
|
||||||
|
|
||||||
const PROGRAM = 'const listing = await tools.bash({ command: "ls notes", description: "List notes" })\nreturn listing'
|
const PROGRAM = 'const listing = await tools.bash({ command: "ls notes", description: "List notes" })\nreturn listing'
|
||||||
|
|||||||
@@ -21,10 +21,21 @@ import type { ToolRowProps } from '@deepseek-ai/dsh-client-ui-conversation/clien
|
|||||||
|
|
||||||
const SID = 's1' as SessionId
|
const SID = 's1' as SessionId
|
||||||
|
|
||||||
afterEach(cleanup)
|
/** jsdom has no ResizeObserver; the composer seat publishes its height through one. */
|
||||||
|
class ResizeObserverStub {
|
||||||
|
observe(): void {}
|
||||||
|
unobserve(): void {}
|
||||||
|
disconnect(): void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.unstubAllGlobals()
|
||||||
|
})
|
||||||
// The chat store persists under its declared key; clear between cases.
|
// The chat store persists under its declared key; clear between cases.
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
|
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
|
||||||
})
|
})
|
||||||
|
|
||||||
const toolResult = (seq: number, callId: string, name: string, args = '{"command":"make build","description":"Build"}'): ToolResultNode => ({
|
const toolResult = (seq: number, callId: string, name: string, args = '{"command":"make build","description":"Build"}'): ToolResultNode => ({
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ describe('render branch tails', () => {
|
|||||||
const view = render(
|
const view = render(
|
||||||
<StatsLine useSession={bindSnapshotSelector(source) as unknown as UseSession<ConversationSnapshot>} />,
|
<StatsLine useSession={bindSnapshotSelector(source) as unknown as UseSession<ConversationSnapshot>} />,
|
||||||
)
|
)
|
||||||
expect(view.getByText('cache hit 0% · 15 tokens · 2 turns · 3 steps')).toBeTruthy()
|
expect(view.container.textContent).toBe('2 turns · 3 steps|Cache hit 0%|Input 9 tok · Output 6 tok')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('AssistantMarkdown reasoning as the streaming tail renders the running ring', () => {
|
it('AssistantMarkdown reasoning as the streaming tail renders the running ring', () => {
|
||||||
|
|||||||
@@ -28,8 +28,21 @@ function fakeWiring() {
|
|||||||
return { wiring: shell, sink, shell }
|
return { wiring: shell, sink, shell }
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(cleanup)
|
/** jsdom has no ResizeObserver; the composer seat publishes its height through one. */
|
||||||
beforeEach(() => { localStorage.clear() })
|
class ResizeObserverStub {
|
||||||
|
observe(): void {}
|
||||||
|
unobserve(): void {}
|
||||||
|
disconnect(): void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.unstubAllGlobals()
|
||||||
|
})
|
||||||
|
beforeEach(() => {
|
||||||
|
localStorage.clear()
|
||||||
|
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
|
||||||
|
})
|
||||||
|
|
||||||
const sid = (id: string) => id as SessionId
|
const sid = (id: string) => id as SessionId
|
||||||
const wid = (id: string) => id as WorkspaceId
|
const wid = (id: string) => id as WorkspaceId
|
||||||
|
|||||||
Reference in New Issue
Block a user