Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/simulation/src/frontend/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const create = Effect.fn("SimulationRenderer.create")(function* (
...options,
width: cols,
height: rows,
kittyKeyboard: Boolean(options.useKittyKeyboard),
...(recording
? {
stdout: recording as unknown as NodeJS.WriteStream,
Expand Down
19 changes: 19 additions & 0 deletions packages/simulation/test/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ test("normalizes named keys for OpenTUI", async () => {
])
})

test("headless input mirrors the configured kitty keyboard protocol", async () => {
await Effect.runPromise(
Effect.scoped(
Effect.gen(function* () {
const renderer = yield* SimulationRenderer.create({ useKittyKeyboard: {} })
const harness = createHarness(renderer)
let key: { readonly name: string; readonly source: string } | undefined
renderer.keyInput.once("keypress", (event) => {
key = event
})

yield* execute(harness, { type: "ui.press", key: "escape" })

expect(key).toMatchObject({ name: "escape", source: "kitty" })
}),
),
)
})

test("clicks a target at relative coordinates through descendant text", async () => {
await Effect.runPromise(
Effect.scoped(
Expand Down
Loading