Files
oh-my-pi/packages/coding-agent/test/modes/controllers/command-controller-hotkeys.test.ts
T
can1357 40ed8852b5 feat(coding-agent): added app.display.reset bound to Ctrl+L
- Added `TUI.resetDisplay()` to force an immediate full-frame replay including native scrollback.
- Moved the persistent model selector default from Ctrl+L to Alt+M, preserving existing user remaps.
- Reserved Alt+M so extensions cannot shadow the model selector shortcut.
2026-06-06 17:19:57 +02:00

72 lines
2.4 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { buildHotkeysMarkdown } from "../../../src/modes/utils/hotkeys-markdown";
describe("buildHotkeysMarkdown", () => {
it("emits flush-left markdown and uses the configured temporary selector hint", () => {
const displayStrings: Record<string, string> = {
"app.clipboard.copyLine": "Alt+Shift+L",
"app.clipboard.copyPrompt": "Ctrl+Shift+P",
"app.plan.toggle": "Alt+Shift+P",
"app.tools.expand": "Ctrl+O",
"app.display.reset": "Ctrl+L",
"app.interrupt": "Esc",
"app.clear": "Ctrl+C",
"app.exit": "Ctrl+D",
"app.suspend": "Ctrl+Z",
"app.thinking.cycle": "Shift+Tab",
"app.model.cycleForward": "Ctrl+P",
"app.model.cycleBackward": "Shift+Ctrl+P",
"app.model.selectTemporary": "Ctrl+Shift+L",
"app.model.select": "Alt+M",
"app.history.search": "Ctrl+R",
"app.thinking.toggle": "Ctrl+T",
"app.editor.external": "Ctrl+G",
"app.clipboard.pasteImage": "Ctrl+V",
"app.stt.toggle": "Alt+H",
};
const markdown = buildHotkeysMarkdown({
keybindings: {
getDisplayString(action) {
return displayStrings[action] ?? "Disabled";
},
},
});
const lines = markdown.split("\n");
expect(lines[0]).toBe("**Navigation**");
expect(markdown).toContain("| `Ctrl+Shift+P` | Copy whole prompt |");
expect(markdown).toContain("| `Ctrl+Shift+L` | Select model (temporary) |");
expect(markdown).toContain("| `Alt+M` | Select model (set roles) |");
expect(markdown).toContain("| `Ctrl+L` | Reset terminal display |");
expect(markdown).toContain("| `Alt+Shift+P` | Toggle plan mode |");
expect(markdown).toContain("| `#` | Open prompt actions |");
for (const line of lines) {
if (line.length === 0) continue;
expect(line.startsWith(" ")).toBe(false);
expect(line.startsWith("\t")).toBe(false);
}
});
it("renders the temporary selector row as disabled when no display string is configured", () => {
const markdown = buildHotkeysMarkdown({
keybindings: {
getDisplayString(action) {
if (action === "app.model.selectTemporary") {
return "";
}
if (action === "app.model.select") {
return "Alt+M";
}
if (action === "app.display.reset") {
return "Ctrl+L";
}
return "Ctrl+K";
},
},
});
expect(markdown).toContain("| `Disabled` | Select model (temporary) |");
expect(markdown).toContain("| `Alt+M` | Select model (set roles) |");
});
});