Files
t3tui/test/hints.test.ts
T
Callum Alpass 12e1e0ba7a Add mouse support across the TUI
Drag to select copies on release. Request cards, the queue, attachments,
the PR view and the key hints get clickable buttons. Prompts, folds,
commands and diff files respond to clicks; prompts, replies, commands and
the PR view get right-click menus. Clicking a pane focuses it, the wheel
scrolls the thread list and palette, rows highlight under the pointer, and
the thread list's border drags to resize.
2026-11-02 22:13:40 +11:00

26 lines
1.2 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { hintKey } from "../src/model/hints.ts";
describe("clickable key hints", () => {
test("single keys, shifted keys and ctrl chords", () => {
expect(hintKey("y approve", "nav")).toEqual({ name: "y", sequence: "y", shift: false, ctrl: false });
expect(hintKey("Y always", "nav")).toEqual({ name: "y", sequence: "Y", shift: true, ctrl: false });
expect(hintKey("ctrl+k commands", "nav")).toEqual({ name: "k", sequence: "\x0b", shift: false, ctrl: true });
expect(hintKey("esc close", "palette")?.name).toBe("escape");
expect(hintKey(". actions", "nav")?.name).toBe(".");
expect(hintKey("/ filter", "nav")?.name).toBe("/");
});
test("choices of keys, ranges and sending chords stay text", () => {
expect(hintKey("j/k threads", "nav")).toBeNull();
expect(hintKey("ctrl+n/p thread", "input")).toBeNull();
expect(hintKey("1-9 pick", "nav")).toBeNull();
expect(hintKey("alt+enter steer", "input")).toBeNull();
expect(hintKey("alt+↑ edit queued", "input")).toBeNull();
expect(hintKey("shift+enter or \\ newline", "input")).toBeNull();
expect(hintKey("enter send", "input")).toBeNull();
expect(hintKey("enter confirm", "confirm")?.name).toBe("return");
});
});