zidane-ui/ workspace/ testing
import { … } from 'zidane-ui/workspace/testing'ui/src/workspace/testing/index.ts
Functions#
createFixtureWorkspaceHostFunction#
Creates a WorkspaceHost held in memory: layouts per scope key and, unless panels: false, extension panels
per folder.
function createFixtureWorkspaceHost(
options?: FixtureWorkspaceOptions,
): FixtureWorkspaceHostParameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | FixtureWorkspaceOptions | {} | The stored layouts and the extension panels. |
Returns
Constants#
DEMO_WORKSPACE_LAYOUTConstant#
A demo layout: open, Files and Todos in one group, Diffs split off to the right.
const DEMO_WORKSPACE_LAYOUT: WorkspaceLayoutDEMO_WORKSPACE_TABSConstant#
The tabs the demos offer: an app's own kinds, as the desktop app's catalog lists them.
const DEMO_WORKSPACE_TABS: readonly WorkspaceTab[]Interfaces#
FixtureWorkspaceControlInterface#
Changes the fixture from outside, as another window or an extension would.
interface FixtureWorkspaceControlProperties
| Name | Type | Description |
|---|---|---|
| actions | () => readonly { actionId: string; cwd: string; panelId: string; payload: unknown }[] | The actions run so far, oldest first. |
| changePanel | (cwd: string, panelId: string) => void | Announces that a panel changed. |
| setCatalog | (cwd: string, panels: readonly WorkspacePanelSummary[]) => void | Replaces a folder's catalog and announces it. |
| setContent | (cwd: string, panelId: string, content: PanelContent) => void | Replaces a panel's content and announces the change. |
| setLayout | (key: string, layout: WorkspaceLayout) => void | Stores |
| watching | () => readonly string[] | The panels watched now, as |
FixtureWorkspaceHostInterface#
The WorkspaceHost createFixtureWorkspaceHost returns, with its control.
interface FixtureWorkspaceHost extends WorkspaceHostProperties
| Name | Type | Description |
|---|---|---|
| control | FixtureWorkspaceControl | Changes the fixture from outside. |
layouts?from WorkspaceHost | WorkspaceLayouts<WorkspaceScope> | Persistent layouts. Absent: layouts last as long as the page. |
panels?from WorkspaceHost | WorkspacePanels | Extension panels. Absent: only the app's own tabs. |
FixtureWorkspaceOptionsInterface#
Options of createFixtureWorkspaceHost.
interface FixtureWorkspaceOptionsProperties
| Name | Type | Description |
|---|---|---|
| initial? | WorkspaceLayout | What a scope with nothing stored reads. Default: closed, no tab. |
| layouts? | Readonly<Record<string, WorkspaceLayout>> | The layouts stored per scope key. |
| panels? | false | { catalog: Readonly<Record<string, readonly WorkspacePanelSummary[]>>; content: Readonly<Record<string, PanelContent>>; failing?: Readonly<Record<string, string>> } | Extension panels, per folder. |