From 8e4f053c63cfb28b7168241da40ecb75fef50a39 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Wed, 10 Apr 2024 16:01:53 -0500 Subject: [PATCH] Added test case (#1909) --- packages/react-hooks/src/useCheckOverflow.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/react-hooks/src/useCheckOverflow.test.ts b/packages/react-hooks/src/useCheckOverflow.test.ts index 35c2eb38df..9499e91889 100644 --- a/packages/react-hooks/src/useCheckOverflow.test.ts +++ b/packages/react-hooks/src/useCheckOverflow.test.ts @@ -27,17 +27,21 @@ describe('useCheckOverflow', () => { }); it.each([ + [null, false], [isOverflowing, true], [scrollWidthMatchesOffsetWidth, false], [offsetWidthGreaterThanScrollWidth, false], ])( - 'should check if a Spectrum `DOMRefValue` is overflowing', + 'should check if a Spectrum `DOMRefValue` is overflowing: %s, %s', (el, expected) => { const { result } = renderHook(() => useCheckOverflow()); - const elRef = createMockProxy>({ - UNSAFE_getDOMNode: () => createMockProxy(el), - }); + const elRef = + el == null + ? null + : createMockProxy>({ + UNSAFE_getDOMNode: () => createMockProxy(el), + }); act(() => { result.current.checkOverflow(elRef);