diff --git a/apps/yaak-client/components/core/HotkeyList.test.tsx b/apps/yaak-client/components/core/HotkeyList.test.tsx new file mode 100644 index 00000000..47d99f4b --- /dev/null +++ b/apps/yaak-client/components/core/HotkeyList.test.tsx @@ -0,0 +1,25 @@ +import { renderToStaticMarkup } from "react-dom/server"; +import { describe, expect, test, vi } from "vite-plus/test"; +import type { HotkeyAction } from "../../hooks/useHotKey"; +import { HotkeyList } from "./HotkeyList"; + +vi.mock("./Hotkey", () => ({ + Hotkey: ({ action }: { action: HotkeyAction }) => + action === "sidebar.selected.move" ? null : {action}, +})); + +vi.mock("./HotkeyLabel", () => ({ + HotkeyLabel: ({ action }: { action: HotkeyAction }) => {action}, +})); + +describe("HotkeyList", () => { + test("keeps a grid cell for actions without a shortcut", () => { + const markup = renderToStaticMarkup( + , + ); + + expect(markup).toContain( + 'sidebar.selected.move
request.send', + ); + }); +}); diff --git a/apps/yaak-client/components/core/HotkeyList.tsx b/apps/yaak-client/components/core/HotkeyList.tsx index 202dd059..91f90254 100644 --- a/apps/yaak-client/components/core/HotkeyList.tsx +++ b/apps/yaak-client/components/core/HotkeyList.tsx @@ -18,7 +18,10 @@ export const HotkeyList = ({ hotkeys, bottomSlot, className }: Props) => { {hotkeys.map((hotkey) => ( - + {/* Keep this grid cell when Hotkey renders nothing so later rows stay aligned. */} +
+ +
))} {bottomSlot}