Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: first pass at trying to mock ResizeObserver for tests (#604)
### **PR Type** Tests, Enhancement ___ ### **Description** - Added a mock implementation of `ResizeObserver` for testing purposes. - Created comprehensive tests for the `useResizeObserver` hook using the mock `ResizeObserver`. - Refactored `useResizeObserver` to handle cases where `ResizeObserver` is undefined, improving robustness. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>useResizeObserver.test.tsx</strong><dd><code>Add tests for `useResizeObserver` with `ResizeObserver` mock</code></dd></summary> <hr> packages/ui-hooks/src/hooks/__tests__/useResizeObserver.test.tsx <li>Added a mock implementation for <code>ResizeObserver</code>.<br> <li> Created tests for <code>useResizeObserver</code> hook.<br> <li> Simulated resize events in tests.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/604/files#diff-817c498322b1d9ec6ea8df205b7893101d4b89f74fb9e6ef998d09c64931389d">+111/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>useResizeObserver.ts</strong><dd><code>Refactor `useResizeObserver` to handle undefined `ResizeObserver`</code></dd></summary> <hr> packages/ui-hooks/src/hooks/useResizeObserver.ts <li>Refactored <code>useResizeObserver</code> to handle <code>ResizeObserver</code> undefined case.<br> <li> Removed unnecessary comments and adjusted memoization logic.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/604/files#diff-bb3ddb329d4b3f6fd8a1e761a789d33ba9e6b3556d42068d3928b15ff426bda1">+20/-22</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
- Loading branch information