MobileMenu.test.tsx 994 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { UI } from "@excalidraw/excalidraw/tests/helpers/ui";
  2. import {
  3. mockBoundingClientRect,
  4. render,
  5. restoreOriginalGetBoundingClientRect,
  6. } from "@excalidraw/excalidraw/tests/test-utils";
  7. import ExcalidrawApp from "../App";
  8. describe("Test MobileMenu", () => {
  9. const { h } = window;
  10. const dimensions = { height: 400, width: 800 };
  11. beforeAll(() => {
  12. mockBoundingClientRect(dimensions);
  13. });
  14. beforeEach(async () => {
  15. await render(<ExcalidrawApp />);
  16. h.app.refreshEditorInterface();
  17. });
  18. afterAll(() => {
  19. restoreOriginalGetBoundingClientRect();
  20. });
  21. it("should set editor interface correctly", () => {
  22. expect(h.app.editorInterface.formFactor).toBe("phone");
  23. });
  24. it("should initialize with welcome screen and hide once user interacts", async () => {
  25. expect(document.querySelector(".welcome-screen-center")).toMatchSnapshot();
  26. UI.clickTool("rectangle");
  27. expect(document.querySelector(".welcome-screen-center")).toBeNull();
  28. });
  29. });