Skip to content

Commit

Permalink
Fixed tests (DH-18088)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Jan 3, 2025
1 parent 56ee44c commit f460a62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ describe('usePickerScrollOnOpen', () => {
expect(result.current.ref).toBe(mockUsePopoverOnScrollRefResult.ref);
});

it.each([true, false])(
'should return a callback that calls popoverOnOpenChange and onOpenChange: %s',
isOpen => {
it.each([
[true, undefined],
[false, undefined],
[true, 'input'],
[false, 'input'],
] as const)(
'should return a callback that calls popoverOnOpenChange and onOpenChange: %s, %s',
(isOpen, menuTrigger) => {
const { result } = renderHook(() =>
usePickerScrollOnOpen({
getInitialScrollPosition,
Expand All @@ -60,12 +65,12 @@ describe('usePickerScrollOnOpen', () => {
})
);

result.current.onOpenChange(isOpen);
result.current.onOpenChange(isOpen, menuTrigger);

expect(mockUsePopoverOnScrollRefResult.onOpenChange).toHaveBeenCalledWith(
isOpen
);
expect(onOpenChange).toHaveBeenCalledWith(isOpen);
expect(onOpenChange).toHaveBeenCalledWith(isOpen, menuTrigger);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface UsePickerScrollOnOpenOptions {

export interface UsePickerScrollOnOpenResult<THtml extends HTMLElement> {
ref: DOMRef<THtml>;
onOpenChange: (isOpen: boolean) => void;
onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;
}

/**
Expand Down

0 comments on commit f460a62

Please sign in to comment.