blob: 052d18eae77625bbf3d9e3f65bf86ae12135a23a (
plain) (
blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import '@testing-library/jest-dom';
// Mock IntersectionObserver
class IntersectionObserver {
readonly root: Element | null = null;
readonly rootMargin: string = '';
readonly thresholds: ReadonlyArray<number> = [];
constructor(_callback: IntersectionObserverCallback, _options?: IntersectionObserverInit) {
// nothing
}
observe(_target: Element): void {
// nothing
}
unobserve(_target: Element): void {
// nothing
}
disconnect(): void {
// nothing
}
takeRecords(): IntersectionObserverEntry[] {
return [];
}
}
Object.defineProperty(window, 'IntersectionObserver', {
writable: true,
configurable: true,
value: IntersectionObserver,
});
Object.defineProperty(globalThis, 'IntersectionObserver', {
writable: true,
configurable: true,
value: IntersectionObserver,
});
|