diff --git a/src/renderer/components/cluster-manager/active-hotbar-name.tsx b/src/renderer/components/cluster-manager/active-hotbar-name.tsx index 29e750d59f..2db75187ec 100644 --- a/src/renderer/components/cluster-manager/active-hotbar-name.tsx +++ b/src/renderer/components/cluster-manager/active-hotbar-name.tsx @@ -23,11 +23,17 @@ import React from "react"; import { observer } from "mobx-react"; import { Icon } from "../icon"; import { HotbarStore } from "../../../common/hotbar-store"; +import { CommandOverlay } from "../command-palette"; +import { HotbarSwitchCommand } from "../hotbar/hotbar-switch-command"; export const ActiveHotbarName = observer(() => { return ( -
- {" "} +
CommandOverlay.open()} + > + {HotbarStore.getInstance().getActive()?.name}
); diff --git a/src/renderer/components/cluster-manager/bottom-bar.test.tsx b/src/renderer/components/cluster-manager/bottom-bar.test.tsx index 6eba477bcb..3e26e2a7d6 100644 --- a/src/renderer/components/cluster-manager/bottom-bar.test.tsx +++ b/src/renderer/components/cluster-manager/bottom-bar.test.tsx @@ -21,12 +21,20 @@ import React from "react"; import mockFs from "mock-fs"; -import { render } from "@testing-library/react"; +import { render, fireEvent } from "@testing-library/react"; import "@testing-library/jest-dom/extend-expect"; import { BottomBar } from "./bottom-bar"; import { StatusBarRegistry } from "../../../extensions/registries"; import { HotbarStore } from "../../../common/hotbar-store"; import { AppPaths } from "../../../common/app-paths"; +import { CommandOverlay } from "../command-palette"; +import { HotbarSwitchCommand } from "../hotbar/hotbar-switch-command"; + +jest.mock("../command-palette", () => ({ + CommandOverlay: { + open: jest.fn(), + }, +})); AppPaths.init(); @@ -128,4 +136,13 @@ describe("", () => { expect(getByTestId("current-hotbar-name")).toHaveTextContent("new"); }); + + it("opens command palette on click", () => { + const { getByTestId } = render(); + const activeHotbar = getByTestId("current-hotbar-name"); + + fireEvent.click(activeHotbar); + + expect(CommandOverlay.open).toHaveBeenCalledWith(); + }); });