| import "@testing-library/jest-dom/vitest"; |
| import { cleanup } from "@testing-library/react"; |
| import { afterEach } from "vitest"; |
|
|
| |
| if (typeof window.matchMedia !== "function") { |
| Object.defineProperty(window, "matchMedia", { |
| writable: true, |
| value: (query: string) => ({ |
| matches: false, |
| media: query, |
| onchange: null, |
| addListener: () => {}, |
| removeListener: () => {}, |
| addEventListener: () => {}, |
| removeEventListener: () => {}, |
| dispatchEvent: () => false, |
| }), |
| }); |
| } |
|
|
| |
| if (typeof globalThis.ResizeObserver === "undefined") { |
| globalThis.ResizeObserver = class ResizeObserver { |
| observe() {} |
| unobserve() {} |
| disconnect() {} |
| } as unknown as typeof globalThis.ResizeObserver; |
| } |
|
|
| |
| if (typeof Element.prototype.scrollIntoView !== "function") { |
| Element.prototype.scrollIntoView = () => {}; |
| } |
|
|
| afterEach(() => { |
| cleanup(); |
| }); |
|
|