-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
27 lines (24 loc) · 825 Bytes
/
vitest.setup.ts
File metadata and controls
27 lines (24 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* eslint-disable @typescript-eslint/no-explicit-any */
import '@testing-library/jest-dom';
import { vi } from 'vitest';
class MockPointerEvent extends Event {
button: number;
ctrlKey: boolean;
pointerType: string;
constructor(type: string, props: PointerEventInit) {
super(type, props);
this.button = props.button || 0;
this.ctrlKey = props.ctrlKey || false;
this.pointerType = props.pointerType || 'mouse';
}
}
(window as any).PointerEvent = MockPointerEvent;
(window as any).HTMLElement.prototype.scrollIntoView = vi.fn();
(window as any).HTMLElement.prototype.hasPointerCapture = vi.fn();
(window as any).HTMLElement.prototype.releasePointerCapture = vi.fn();
class MockResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
(window as any).ResizeObserver = MockResizeObserver;