mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 05:00:41 +00:00
test(tui): cover non-qwerty kitty base layout fallback
This commit is contained in:
parent
5bb3700717
commit
c27168840c
3 changed files with 39 additions and 0 deletions
|
|
@ -83,6 +83,24 @@ describe("matchesKey", () => {
|
|||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should prefer codepoint for Latin letters even when base layout differs", () => {
|
||||
setKittyProtocolActive(true);
|
||||
// Dvorak Ctrl+K reports codepoint 'k' (107) and base layout 'v' (118)
|
||||
const dvorakCtrlK = "\x1b[107::118;5u";
|
||||
assert.strictEqual(matchesKey(dvorakCtrlK, "ctrl+k"), true);
|
||||
assert.strictEqual(matchesKey(dvorakCtrlK, "ctrl+v"), false);
|
||||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should prefer codepoint for symbol keys even when base layout differs", () => {
|
||||
setKittyProtocolActive(true);
|
||||
// Dvorak Ctrl+/ reports codepoint '/' (47) and base layout '[' (91)
|
||||
const dvorakCtrlSlash = "\x1b[47::91;5u";
|
||||
assert.strictEqual(matchesKey(dvorakCtrlSlash, "ctrl+/"), true);
|
||||
assert.strictEqual(matchesKey(dvorakCtrlSlash, "ctrl+["), false);
|
||||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should not match wrong key even with base layout", () => {
|
||||
setKittyProtocolActive(true);
|
||||
// Cyrillic ctrl+с with base 'c' should NOT match ctrl+d
|
||||
|
|
@ -254,6 +272,22 @@ describe("parseKey", () => {
|
|||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should prefer codepoint for Latin letters when base layout differs", () => {
|
||||
setKittyProtocolActive(true);
|
||||
// Dvorak Ctrl+K reports codepoint 'k' (107) and base layout 'v' (118)
|
||||
const dvorakCtrlK = "\x1b[107::118;5u";
|
||||
assert.strictEqual(parseKey(dvorakCtrlK), "ctrl+k");
|
||||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should prefer codepoint for symbol keys when base layout differs", () => {
|
||||
setKittyProtocolActive(true);
|
||||
// Dvorak Ctrl+/ reports codepoint '/' (47) and base layout '[' (91)
|
||||
const dvorakCtrlSlash = "\x1b[47::91;5u";
|
||||
assert.strictEqual(parseKey(dvorakCtrlSlash), "ctrl+/");
|
||||
setKittyProtocolActive(false);
|
||||
});
|
||||
|
||||
it("should return key name from codepoint when no base layout", () => {
|
||||
setKittyProtocolActive(true);
|
||||
const latinCtrlC = "\x1b[99;5u";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue