spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / tests / fixtures / pane-view / docks-pane.ts
35 lines · 1011 BRaw
1import type { On, RenderElement } from 'claude-code'
2import type { Engine } from 'claude-code/testing'
3
4import PaneState from '../../../hooks/pane-state'
5import Views from '../../../hooks/views'
6import { drawsPane } from './draws-pane.js'
7import { VIEW_PANE } from './view-pane.js'
8
9/**
10 * The pane docked beneath the plugin over whichever model the test hands
11 * next.
12 *
13 * Each call draws VIEW_PANE through the engine with `paneView` over that
14 * model and answers the tree the engine took.
15 *
16 * @param $ the test's `$`
17 * @param on the test's `on`
18 * @param overrides kit members that differ from the ordinary ones
19 * @returns draws the pane over a model
20 */
21export function docksPane(
22 $: Engine,
23 on: On,
24 overrides: Partial<Omit<Views.Kit, 'ui'>> = {},
25): (model: PaneState.PaneModel) => Promise<RenderElement> {
26 let model = PaneState.INITIAL_MODEL
27
28 drawsPane(on, kit => Views.paneView(kit, model, 'dock'), overrides)
29
30 return next => {
31 model = next
32
33 return $.ui.render(VIEW_PANE)
34 }
35}