feat: move the terminal fully into the ssh-terminal plugin (B9)

This commit is contained in:
LukeGus committed 2026-09-23 21:41:22 -05:00
1 parent 535126fd1b
commit 79d77678c9
309 files changed
+41789 -14958

No files matched your search

@@ -0,0 +1,50 @@
import { describe, expect, it, vi } from "vitest";
import { getMacLineNavigationSequence } from "../../../src/frontend/lib/mac-line-navigation";
function keyEvent(
init: Partial<KeyboardEvent> & Pick<KeyboardEvent, "code">,
): KeyboardEvent {
return {
type: "keydown",
altKey: false,
ctrlKey: false,
metaKey: false,
shiftKey: false,
...init,
} as KeyboardEvent;
}
describe("getMacLineNavigationSequence", () => {
it("maps Cmd+arrow keys on macOS", () => {
vi.stubGlobal("navigator", { platform: "MacIntel" });
expect(
getMacLineNavigationSequence(
keyEvent({ code: "ArrowLeft", metaKey: true }),
),
).toBe("\x01");
expect(
getMacLineNavigationSequence(
keyEvent({ code: "ArrowRight", metaKey: true }),
),
).toBe("\x05");
vi.unstubAllGlobals();
});
it("ignores modified and non-mac shortcuts", () => {
vi.stubGlobal("navigator", { platform: "MacIntel" });
expect(
getMacLineNavigationSequence(
keyEvent({ code: "ArrowLeft", metaKey: true, shiftKey: true }),
),
).toBeNull();
vi.unstubAllGlobals();
vi.stubGlobal("navigator", { platform: "Win32" });
expect(
getMacLineNavigationSequence(
keyEvent({ code: "ArrowLeft", metaKey: true }),
),
).toBeNull();
vi.unstubAllGlobals();
});
});