mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-08-24 00:22:27 +02:00
46 lines
931 B
TypeScript
46 lines
931 B
TypeScript
import { afterEach, vi } from 'vitest';
|
|
|
|
class TestDOMMatrix {
|
|
a = 1;
|
|
b = 0;
|
|
c = 0;
|
|
d = 1;
|
|
e = 0;
|
|
f = 0;
|
|
}
|
|
|
|
if (typeof globalThis.DOMMatrix === 'undefined') {
|
|
globalThis.DOMMatrix = TestDOMMatrix as unknown as typeof DOMMatrix;
|
|
}
|
|
|
|
afterEach(() => {
|
|
document.body.innerHTML = '';
|
|
document.head.innerHTML = '';
|
|
});
|
|
|
|
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}));
|
|
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(),
|
|
removeListener: vi.fn(),
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|
|
|
|
global.IntersectionObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}));
|