Skip to content

Commit

Permalink
Added test case (#1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Apr 11, 2024
1 parent 342b24c commit a65e539
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/react-hooks/src/useCheckOverflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DOMRefValue<HTMLDivElement>>({
UNSAFE_getDOMNode: () => createMockProxy<HTMLDivElement>(el),
});
const elRef =
el == null
? null
: createMockProxy<DOMRefValue<HTMLDivElement>>({
UNSAFE_getDOMNode: () => createMockProxy<HTMLDivElement>(el),
});

act(() => {
result.current.checkOverflow(elRef);
Expand Down

0 comments on commit a65e539

Please sign in to comment.