feat: close dropdown on escape (#7750)

This commit is contained in:
David Luzar
2024-03-05 23:22:34 +01:00
committed by GitHub
parent a07f6e9e3a
commit a38e82f999
2 changed files with 45 additions and 2 deletions
@@ -0,0 +1,20 @@
import { Excalidraw } from "../../index";
import { KEYS } from "../../keys";
import { Keyboard } from "../../tests/helpers/ui";
import { render, waitFor, getByTestId } from "../../tests/test-utils";
describe("Test <DropdownMenu/>", () => {
it("should", async () => {
const { container } = await render(<Excalidraw />);
expect(window.h.state.openMenu).toBe(null);
getByTestId(container, "main-menu-trigger").click();
expect(window.h.state.openMenu).toBe("canvas");
await waitFor(() => {
Keyboard.keyDown(KEYS.ESCAPE);
expect(window.h.state.openMenu).toBe(null);
});
});
});