We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents dceba7f + 712ae37 commit 01c9992Copy full SHA for 01c9992
1 file changed
src/test-utils.ts
@@ -96,8 +96,13 @@ export function setupIntersectionMocking(mockFn: typeof jest.fn) {
96
* Reset the IntersectionObserver mock to its initial state, and clear all the elements being observed.
97
*/
98
export function resetIntersectionMocking() {
99
- // @ts-ignore
100
- if (global.IntersectionObserver) global.IntersectionObserver.mockClear();
+ if (
+ global.IntersectionObserver &&
101
+ "mockClear" in global.IntersectionObserver &&
102
+ typeof global.IntersectionObserver.mockClear === "function"
103
+ ) {
104
+ global.IntersectionObserver.mockClear();
105
+ }
106
observers.clear();
107
}
108
0 commit comments