Skip to content

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.

TypeScript
function createFixtureWorkspaceHost(
  options?: FixtureWorkspaceOptions,
): FixtureWorkspaceHost
Parameters
NameTypeDefaultDescription
options?FixtureWorkspaceOptions{}

The stored layouts and the extension panels.

ui/src/workspace/testing/index.ts:60

Constants#

DEMO_WORKSPACE_LAYOUTConstant#

A demo layout: open, Files and Todos in one group, Diffs split off to the right.

TypeScript
const DEMO_WORKSPACE_LAYOUT: WorkspaceLayout

ui/src/workspace/testing/index.ts:136

DEMO_WORKSPACE_TABSConstant#

The tabs the demos offer: an app's own kinds, as the desktop app's catalog lists them.

TypeScript
const DEMO_WORKSPACE_TABS: readonly WorkspaceTab[]

ui/src/workspace/testing/index.ts:127

Interfaces#

FixtureWorkspaceControlInterface#

Changes the fixture from outside, as another window or an extension would.

TypeScript
interface FixtureWorkspaceControl
FixtureWorkspaceControl properties
NameTypeDescription
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 layout for the scope key, as another window would.

watching() => readonly string[]

The panels watched now, as cwd/panelId.

ui/src/workspace/testing/index.ts:33

FixtureWorkspaceHostInterface#

The WorkspaceHost createFixtureWorkspaceHost returns, with its control.

TypeScript
interface FixtureWorkspaceHost extends WorkspaceHost
FixtureWorkspaceHost properties
NameTypeDescription
controlFixtureWorkspaceControl

Changes the fixture from outside.

layouts?from WorkspaceHostWorkspaceLayouts<WorkspaceScope>

Persistent layouts. Absent: layouts last as long as the page.

panels?from WorkspaceHostWorkspacePanels

Extension panels. Absent: only the app's own tabs.

ui/src/workspace/testing/index.ts:49

FixtureWorkspaceOptionsInterface#

Options of createFixtureWorkspaceHost.

TypeScript
interface FixtureWorkspaceOptions
FixtureWorkspaceOptions properties
NameTypeDescription
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. false: no panels member. Default: none offered.

ui/src/workspace/testing/index.ts:14