Files
oh-my-pi/packages/coding-agent/test/keybindings-display.test.ts
T
roboomp 5174ba0155 fix(tui): registered ctrl-v image paste on windows
Kept Ctrl+V as a default clipboard-image paste shortcut on Windows while preserving Alt+V as the Windows Terminal-safe fallback.

Updated keybinding docs and regression coverage for the platform-specific default.

Fixes #1708
2026-06-02 11:15:09 +00:00

40 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { KeybindingsManager, getDefaultPasteImageKeys } from "../src/config/keybindings";
describe("KeybindingsManager.getDisplayString", () => {
it("formats a single binding as a human-readable key hint", () => {
const keybindings = KeybindingsManager.inMemory({
"app.message.dequeue": "alt+up",
});
expect(keybindings.getDisplayString("app.message.dequeue")).toBe("Alt+Up");
});
it("formats multiple bindings with the existing separator", () => {
const keybindings = KeybindingsManager.inMemory({
"app.clipboard.copyPrompt": ["alt+shift+c", "ctrl+shift+c"],
});
expect(keybindings.getDisplayString("app.clipboard.copyPrompt")).toBe("Alt+Shift+C/Ctrl+Shift+C");
});
it("returns an empty string when the action has no binding", () => {
const keybindings = KeybindingsManager.inMemory({
"app.clipboard.copyPrompt": [],
});
expect(keybindings.getDisplayString("app.clipboard.copyPrompt")).toBe("");
});
});
describe("getDefaultPasteImageKeys", () => {
it("keeps Ctrl+V registered for image paste on Windows alongside the terminal-safe fallback", () => {
expect(getDefaultPasteImageKeys("win32")).toEqual(["ctrl+v", "alt+v"]);
});
it("uses Ctrl+V as the image-paste shortcut on non-Windows platforms", () => {
expect(getDefaultPasteImageKeys("linux")).toEqual(["ctrl+v"]);
expect(getDefaultPasteImageKeys("darwin")).toEqual(["ctrl+v"]);
});
});