feat: implement chroma key operation and related keybinds, update workspace panel management
This commit is contained in:
22
input/operation-keybinds.test.ts
Normal file
22
input/operation-keybinds.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { commandIds } from "@commands/ids";
|
||||
import type { Dispatch } from "@commands/dispatcher";
|
||||
import { handleOperationKey } from "./operation-keybinds";
|
||||
|
||||
describe("operation keybinds", () => {
|
||||
test.each([
|
||||
["g", "generate"],
|
||||
["k", "chromaKey"],
|
||||
] as const)("opens the %s operation without selecting a tool", (key, panel) => {
|
||||
const dispatched: unknown[] = [];
|
||||
const consumed = handleOperationKey({
|
||||
event: { key, code: `Key${key.toUpperCase()}`, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false },
|
||||
dispatch: ((commandId: unknown, payload: unknown) => {
|
||||
dispatched.push({ commandId, payload });
|
||||
return undefined;
|
||||
}) as unknown as Dispatch,
|
||||
});
|
||||
expect(consumed).toBe(true);
|
||||
expect(dispatched).toEqual([{ commandId: commandIds.workspaceSetPanel, payload: { panel } }]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user