27 lines
713 B
TypeScript
27 lines
713 B
TypeScript
|
import { vi } from "vitest";
|
||
|
|
||
|
window.matchMedia = vi.fn().mockImplementation((query) => ({
|
||
|
matches: false,
|
||
|
media: query,
|
||
|
onchange: null,
|
||
|
addListener: vi.fn(), // deprecated
|
||
|
removeListener: vi.fn(), // deprecated
|
||
|
addEventListener: vi.fn(),
|
||
|
removeEventListener: vi.fn(),
|
||
|
dispatchEvent: vi.fn(),
|
||
|
}));
|
||
|
|
||
|
// Object.defineProperty(window, "matchMedia", {
|
||
|
// writable: true,
|
||
|
// value: vi.fn().mockImplementation((query) => ({
|
||
|
// matches: false,
|
||
|
// media: query,
|
||
|
// onchange: null,
|
||
|
// addListener: vi.fn(), // deprecated
|
||
|
// removeListener: vi.fn(), // deprecated
|
||
|
// addEventListener: vi.fn(),
|
||
|
// removeEventListener: vi.fn(),
|
||
|
// dispatchEvent: vi.fn(),
|
||
|
// })),
|
||
|
// });
|