Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
26
js/tests/unit/specs/mocks/matchMedia.ts
Normal file
26
js/tests/unit/specs/mocks/matchMedia.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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(),
|
||||
// })),
|
||||
// });
|
||||
Reference in New Issue
Block a user