@opentui/keymap/testing

Every export of @opentui/keymap/testing in the 0.6.0 release, 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>): TestDiagnosticCapture
Core engine
function createTestHostMetadata(options?: HostMetadata | TestHostMetadataOptions): HostMetadata
Core engine
function createTestKeymap(options?: CreateTestKeymapOptions): TestKeymapHarness
Core engine
function createTestKeymapHost(options?: CreateTestKeymapHostOptions): TestKeymapHost
Core engine

Classes#

class TestKeymapEvent implements KeymapEventconstructor TestKeymapEvent(name: string, modifiers?: TestKeyModifierOptions)
Core engine
  • method TestKeymapEvent.preventDefault(): void
  • method TestKeymapEvent.stopPropagation(): void
  • property TestKeymapEvent.defaultPrevented: boolean
  • property TestKeymapEvent.propagationStopped: boolean
  • readonly property TestKeymapEvent.ctrl: boolean
  • readonly property TestKeymapEvent.hyper?: boolean
  • readonly property TestKeymapEvent.meta: boolean
  • readonly property TestKeymapEvent.name: string
  • readonly property TestKeymapEvent.shift: boolean
  • readonly property TestKeymapEvent.super: boolean
class TestKeymapHost implements KeymapHost<TestKeymapTarget, TestKeymapEvent>constructor TestKeymapHost(options?: CreateTestKeymapHostOptions)
Core engine
  • method TestKeymapHost.createCommandEvent(): TestKeymapEvent
  • method TestKeymapHost.createTarget(id: string): TestKeymapTarget
  • method TestKeymapHost.destroy(): void
  • method TestKeymapHost.destroyTarget(target: TestKeymapTarget): void
  • method TestKeymapHost.focus(target: TestKeymapTarget | null): void
  • method TestKeymapHost.getFocusedTarget(): TestKeymapTarget | null
  • method TestKeymapHost.getParentTarget(target: TestKeymapTarget): TestKeymapTarget | null
  • method TestKeymapHost.isTargetDestroyed(target: TestKeymapTarget): boolean
  • method TestKeymapHost.onDestroy(listener: () => void): () => void
  • method TestKeymapHost.onFocusChange(listener: (target: TestKeymapTarget | null) => void): () => void
  • method TestKeymapHost.onKeyPress(listener: (event: TestKeymapEvent) => void): () => void
  • method TestKeymapHost.onKeyRelease(listener: (event: TestKeymapEvent) => void): () => void
  • method TestKeymapHost.onRawInput(listener: (sequence: string) => boolean): () => void
  • method TestKeymapHost.onTargetDestroy(target: TestKeymapTarget, listener: () => void): () => void
  • method TestKeymapHost.press(name: string, modifiers?: TestKeyModifierOptions): TestKeymapEvent
  • method TestKeymapHost.raw(sequence: string): boolean
  • method TestKeymapHost.release(name: string, modifiers?: TestKeyModifierOptions): TestKeymapEvent
  • property TestKeymapHost.isDestroyed: boolean
  • readonly property TestKeymapHost.metadata: HostMetadata
  • readonly property TestKeymapHost.rootTarget: TestKeymapTarget
class TestKeymapTargetconstructor TestKeymapTarget(id: string)
Core engine
  • method TestKeymapTarget.append(child: TestKeymapTarget): TestKeymapTarget
  • property TestKeymapTarget.isDestroyed: boolean
  • property TestKeymapTarget.parent: TestKeymapTarget | null
  • readonly property TestKeymapTarget.id: string

Interfaces#

interface CreateTestKeymapHostOptions
Core engine
  • property CreateTestKeymapHostOptions.metadata?: HostMetadata | TestHostMetadataOptions
interface CreateTestKeymapOptions extends CreateTestKeymapHostOptions
Core engine
  • property CreateTestKeymapOptions.defaultKeys?: boolean
interface TestDiagnosticCapture
Core engine
  • method TestDiagnosticCapture.clear(): void
  • method TestDiagnosticCapture.dispose(): void
  • method 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 TestKeymapHarness
Core engine
  • method TestKeymapHarness.cleanup(): void
  • property TestKeymapHarness.diagnostics: TestDiagnosticCapture
  • property TestKeymapHarness.host: TestKeymapHost
  • property TestKeymapHarness.keymap: Keymap<TestKeymapTarget, TestKeymapEvent>
  • property TestKeymapHarness.root: TestKeymapTarget

Types#

type TestHostMetadataOptions = Partial<Omit<HostMetadata, "modifiers">> & { modifiers?: Partial<HostMetadata["modifiers"]>; }
Core engine
type TestKeyModifierOptions = Partial<Pick<KeymapEvent, "ctrl" | "shift" | "meta" | "super" | "hyper">>
Core engine

Constants and variables#

const DEFAULT_TEST_HOST_METADATA: HostMetadata
Core engine