Skip to content

Commit cd66113

Browse files
committed
feat: labels
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 49566a1 commit cd66113

2 files changed

Lines changed: 211 additions & 0 deletions

File tree

src/renderer/__helpers__/jest.setup.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,41 @@ Object.defineProperty(navigator, 'clipboard', {
7878
},
7979
configurable: true,
8080
});
81+
82+
// Simple IntersectionObserver mock for test environments (jsdom)
83+
class MockIntersectionObserver {
84+
readonly root: Element | Document | null;
85+
readonly rootMargin: string;
86+
readonly thresholds: number | number[];
87+
88+
constructor(
89+
// callback unused in this mock
90+
_callback: IntersectionObserverCallback,
91+
options?: IntersectionObserverInit,
92+
) {
93+
this.root = (options?.root as Element | Document) ?? null;
94+
this.rootMargin = options?.rootMargin ?? '';
95+
this.thresholds = options?.threshold ?? 0;
96+
}
97+
98+
observe() {
99+
return null;
100+
}
101+
102+
unobserve() {
103+
return null;
104+
}
105+
106+
disconnect() {
107+
return null;
108+
}
109+
110+
takeRecords(): IntersectionObserverEntry[] {
111+
return [];
112+
}
113+
}
114+
115+
// Attach to global if not present
116+
if (typeof (globalThis as any).IntersectionObserver === 'undefined') {
117+
(globalThis as any).IntersectionObserver = MockIntersectionObserver;
118+
}

src/renderer/components/metrics/__snapshots__/LabelsPill.test.tsx.snap

Lines changed: 173 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)