Skip to content

Commit a65e539

Browse files
committed
Added test case (#1909)
1 parent 342b24c commit a65e539

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

packages/react-hooks/src/useCheckOverflow.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ describe('useCheckOverflow', () => {
2727
});
2828

2929
it.each([
30+
[null, false],
3031
[isOverflowing, true],
3132
[scrollWidthMatchesOffsetWidth, false],
3233
[offsetWidthGreaterThanScrollWidth, false],
3334
])(
34-
'should check if a Spectrum `DOMRefValue` is overflowing',
35+
'should check if a Spectrum `DOMRefValue` is overflowing: %s, %s',
3536
(el, expected) => {
3637
const { result } = renderHook(() => useCheckOverflow());
3738

38-
const elRef = createMockProxy<DOMRefValue<HTMLDivElement>>({
39-
UNSAFE_getDOMNode: () => createMockProxy<HTMLDivElement>(el),
40-
});
39+
const elRef =
40+
el == null
41+
? null
42+
: createMockProxy<DOMRefValue<HTMLDivElement>>({
43+
UNSAFE_getDOMNode: () => createMockProxy<HTMLDivElement>(el),
44+
});
4145

4246
act(() => {
4347
result.current.checkOverflow(elRef);

0 commit comments

Comments
 (0)