# zidane-ui/keybindings/testing

Import: `import { … } from 'zidane-ui/keybindings/testing'`. Source: [ui/src/keybindings/testing/index.ts](https://github.com/Tahul/zidane/blob/main/ui/src/keybindings/testing/index.ts).

## Functions

### `createFixtureKeybindingsHost`

Function.

Creates a [`KeybindingsHost`](https://zidane.si/docs/reference/ui-keybindings-headless.md#KeybindingsHost) held in memory.

```ts
function createFixtureKeybindingsHost(
  options?: FixtureKeybindingsOptions,
): FixtureKeybindingsHost
```

**Parameters**

- `options?` (`FixtureKeybindingsOptions`, default `{}`): The stored overrides, and whether they can be saved.

**Returns** `FixtureKeybindingsHost`

Source: [ui/src/keybindings/headless/fixture-host.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/keybindings/headless/fixture-host.ts#L31)

## Interfaces

### `FixtureKeybindingsControl`

Interface.

Changes the stored overrides from outside.

```ts
interface FixtureKeybindingsControl
```

**Properties**

- `store` (`(overrides: Readonly<Record<string, string>>) => void`): The file changed on disk (the next `refresh` reads it).
- `stored` (`() => Readonly<Record<string, string>>`): The stored map now.

Source: [ui/src/keybindings/headless/fixture-host.ts:16](https://github.com/Tahul/zidane/blob/main/ui/src/keybindings/headless/fixture-host.ts#L16)

### `FixtureKeybindingsOptions`

Interface.

Options of [`createFixtureKeybindingsHost`](https://zidane.si/docs/reference/ui-keybindings-testing.md#createFixtureKeybindingsHost).

```ts
interface FixtureKeybindingsOptions
```

**Properties**

- `editable?` (`boolean`): Offer `save`. Default: true.
- `overrides?` (`Readonly<Record<string, string>>`): The stored overrides (action → spec; unknown actions are dropped on read). Default: none.

Source: [ui/src/keybindings/headless/fixture-host.ts:8](https://github.com/Tahul/zidane/blob/main/ui/src/keybindings/headless/fixture-host.ts#L8)

## Types

### `FixtureKeybindingsHost`

Type.

An in-memory [`KeybindingsHost`](https://zidane.si/docs/reference/ui-keybindings-headless.md#KeybindingsHost) and its control.

```ts
type FixtureKeybindingsHost = KeybindingsHost & { control: FixtureKeybindingsControl }
```

Source: [ui/src/keybindings/headless/fixture-host.ts:24](https://github.com/Tahul/zidane/blob/main/ui/src/keybindings/headless/fixture-host.ts#L24)
