Skip to content

Commit 52a1c1e

Browse files
committed
test: mock ResizeObserver for Jest testing environment
1 parent f1730f9 commit 52a1c1e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
// jsdom add motion events to test CSSMotion
22
window.AnimationEvent = window.AnimationEvent || (() => {});
33
window.TransitionEvent = window.TransitionEvent || (() => {});
4+
global.ResizeObserver = jest.fn(() => {
5+
return {
6+
observe() { },
7+
unobserve() { },
8+
disconnect() { },
9+
};
10+
});

0 commit comments

Comments
 (0)