Skip to content

Commit

Permalink
test: mock ResizeObserver for Jest testing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
aojunhao123 committed Feb 18, 2025
1 parent f1730f9 commit 52a1c1e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// jsdom add motion events to test CSSMotion
window.AnimationEvent = window.AnimationEvent || (() => {});
window.TransitionEvent = window.TransitionEvent || (() => {});
global.ResizeObserver = jest.fn(() => {
return {
observe() { },
unobserve() { },
disconnect() { },
};
});

0 comments on commit 52a1c1e

Please sign in to comment.