@opentui/keymap/testing
Every export of @opentui/keymap/testing in the main-branch source, from its type declarations. A version names the release that added an export after the module's first release.
Functions#
function captureKeymapDiagnostics(keymap: Keymap<any, any>): TestDiagnosticCapturefunction createTestHostMetadata(options?: HostMetadata | TestHostMetadataOptions): HostMetadatafunction createTestKeymap(options?: CreateTestKeymapOptions): TestKeymapHarnessfunction createTestKeymapHost(options?: CreateTestKeymapHostOptions): TestKeymapHost
Classes#
class TestKeymapEvent implements KeymapEventconstructor TestKeymapEvent(name: string, modifiers?: TestKeyModifierOptions)method TestKeymapEvent.preventDefault(): voidmethod TestKeymapEvent.stopPropagation(): voidproperty TestKeymapEvent.defaultPrevented: booleanproperty TestKeymapEvent.propagationStopped: booleanreadonly property TestKeymapEvent.ctrl: booleanreadonly property TestKeymapEvent.hyper?: booleanreadonly property TestKeymapEvent.meta: booleanreadonly property TestKeymapEvent.name: stringreadonly property TestKeymapEvent.shift: booleanreadonly property TestKeymapEvent.super: boolean
class TestKeymapHost implements KeymapHost<TestKeymapTarget, TestKeymapEvent>constructor TestKeymapHost(options?: CreateTestKeymapHostOptions)method TestKeymapHost.createCommandEvent(): TestKeymapEventmethod TestKeymapHost.createTarget(id: string): TestKeymapTargetmethod TestKeymapHost.destroy(): voidmethod TestKeymapHost.destroyTarget(target: TestKeymapTarget): voidmethod TestKeymapHost.focus(target: TestKeymapTarget | null): voidmethod TestKeymapHost.getFocusedTarget(): TestKeymapTarget | nullmethod TestKeymapHost.getParentTarget(target: TestKeymapTarget): TestKeymapTarget | nullmethod TestKeymapHost.isTargetDestroyed(target: TestKeymapTarget): booleanmethod TestKeymapHost.onDestroy(listener: () => void): () => voidmethod TestKeymapHost.onFocusChange(listener: (target: TestKeymapTarget | null) => void): () => voidmethod TestKeymapHost.onKeyPress(listener: (event: TestKeymapEvent) => void): () => voidmethod TestKeymapHost.onKeyRelease(listener: (event: TestKeymapEvent) => void): () => voidmethod TestKeymapHost.onRawInput(listener: (sequence: string) => boolean): () => voidmethod TestKeymapHost.onTargetDestroy(target: TestKeymapTarget, listener: () => void): () => voidmethod TestKeymapHost.press(name: string, modifiers?: TestKeyModifierOptions): TestKeymapEventmethod TestKeymapHost.raw(sequence: string): booleanmethod TestKeymapHost.release(name: string, modifiers?: TestKeyModifierOptions): TestKeymapEventproperty TestKeymapHost.isDestroyed: booleanreadonly property TestKeymapHost.metadata: HostMetadatareadonly property TestKeymapHost.rootTarget: TestKeymapTarget
class TestKeymapTargetconstructor TestKeymapTarget(id: string)method TestKeymapTarget.append(child: TestKeymapTarget): TestKeymapTargetproperty TestKeymapTarget.isDestroyed: booleanproperty TestKeymapTarget.parent: TestKeymapTarget | nullreadonly property TestKeymapTarget.id: string
Interfaces#
interface CreateTestKeymapHostOptionsproperty CreateTestKeymapHostOptions.metadata?: HostMetadata | TestHostMetadataOptions
interface CreateTestKeymapOptions extends CreateTestKeymapHostOptionsproperty CreateTestKeymapOptions.defaultKeys?: boolean
interface TestDiagnosticCapturemethod TestDiagnosticCapture.clear(): voidmethod TestDiagnosticCapture.dispose(): voidmethod TestDiagnosticCapture.takeErrors(): { errors: string[]; errorEvents: ErrorEvent[]; }method TestDiagnosticCapture.takeWarnings(): { warnings: string[]; warningEvents: WarningEvent[]; }readonly property TestDiagnosticCapture.errorEvents: readonly ErrorEvent[]readonly property TestDiagnosticCapture.errors: readonly string[]readonly property TestDiagnosticCapture.warningEvents: readonly WarningEvent[]readonly property TestDiagnosticCapture.warnings: readonly string[]
interface TestKeymapHarnessmethod TestKeymapHarness.cleanup(): voidproperty TestKeymapHarness.diagnostics: TestDiagnosticCaptureproperty TestKeymapHarness.host: TestKeymapHostproperty TestKeymapHarness.keymap: Keymap<TestKeymapTarget, TestKeymapEvent>property TestKeymapHarness.root: TestKeymapTarget
Types#
type TestHostMetadataOptions = Partial<Omit<HostMetadata, "modifiers">> & { modifiers?: Partial<HostMetadata["modifiers"]>; }type TestKeyModifierOptions = Partial<Pick<KeymapEvent, "ctrl" | "shift" | "meta" | "super" | "hyper">>
Constants and variables#
const DEFAULT_TEST_HOST_METADATA: HostMetadata