// @vitest-environment happy-dom import React, { act } from "react"; import { createRoot } from "react-dom/client"; import { expect, it } from "vitest"; import { OffCanvasIndicators } from "./OffCanvasIndicators"; (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true; it("rotates an off-canvas indicator with its element", () => { const host = document.createElement("div"); document.body.append(host); const root = createRoot(host); act(() => { root.render( undefined }} />, ); }); const indicator = host.querySelector('[role="button"]'); expect(indicator?.parentElement?.style.transform).toBe("rotate(30deg)"); expect(indicator?.parentElement?.style.transformOrigin).toBe("center"); act(() => root.unmount()); host.remove(); });