import { describe, expect, test } from "bun:test"; import { commandIds } from "@commands/ids"; import { handleCommandPaletteKey } from "./command-palette"; describe("command palette input", () => { test("opens the command palette with the platform shortcut", () => { const dispatched: unknown[] = []; const consumed = handleCommandPaletteKey({ event: { key: "k", code: "KeyK", altKey: false, ctrlKey: false, metaKey: true, shiftKey: false }, dispatch: (commandId, payload) => { dispatched.push({ commandId, payload }); return undefined as never; }, }); expect(consumed).toBe(true); expect(dispatched).toEqual([{ commandId: commandIds.commandPaletteOpen, payload: undefined }]); }); test("ignores unmodified K so the chroma key operation keeps its shortcut", () => { const consumed = handleCommandPaletteKey({ event: { key: "k", code: "KeyK", altKey: false, ctrlKey: false, metaKey: false, shiftKey: false }, dispatch: () => undefined as never, }); expect(consumed).toBe(false); }); });