zidane-ui/ appearance/ testing
import { … } from 'zidane-ui/appearance/testing'ui/src/appearance/testing/index.ts
Functions#
createFixtureAppearanceHostFunction#
Creates an AppearanceHost held in memory.
function createFixtureAppearanceHost(
options?: FixtureAppearanceOptions,
): FixtureAppearanceHostParameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | FixtureAppearanceOptions | {} | Stored preferences, extra themes, and which optional members to offer. |
Returns
memoryStorageFunction#
A Storage double over a Map.
function memoryStorage(): AppearanceStorage & { removeItem(key: string): void }Returns
AppearanceStorage & { removeItem(key: string): void }Interfaces#
FixtureAppearanceControlInterface#
What the fixture recorded, and a way to change it from outside.
interface FixtureAppearanceControlProperties
| Name | Type | Description |
|---|---|---|
| boot | () => BootSnapshot | null | The last snapshot written, or |
| stored | () => string | null | The stored blob, as the storage holds it. |
| storeExternally | (raw: string | null) => void | Another window stored this blob ( |
| windowCalls | () => readonly FixtureWindowCall[] | Every window call, in order. |
FixtureAppearanceOptionsInterface#
Options of createFixtureAppearanceHost.
interface FixtureAppearanceOptionsProperties
| Name | Type | Description |
|---|---|---|
| boot? | boolean | Record the snapshot ( |
| prefs? | Partial<AppearanceState> | Preferences already stored (merged over the defaults). Default: none, a first run. |
| themes? | Readonly<Record<string, readonly Theme[]>> | The extra themes per folder. Default: none ( |
| window? | boolean | Record window calls ( |
Types#
FixtureAppearanceHostType#
An in-memory AppearanceHost and its control.
type FixtureAppearanceHost = AppearanceHost & { control: FixtureAppearanceControl }FixtureWindowCallType#
A window call the fixture recorded.
type FixtureWindowCall =
| { color: string; kind: 'background' }
| { factor: number; kind: 'zoom' }
| { kind: 'nativeTheme'; mode: AppearanceMode }