Skip to content

Commit

Permalink
dry up POM file for ComboboxAction test
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorvnoj committed Oct 3, 2024
1 parent 10f60fa commit 074b99f
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { render } from "@testing-library/react";
import { ComboboxAction as ComboboxActionComponent } from "./ComboboxAction";
import { ComboboxContextProvider } from "../../ComboboxProvider";

interface Action {
label: string;
onClick: () => void;
closeOnActionClick?: boolean;
}

export function renderComboboxAction(
actions: {
label: string;
onClick: () => void;
closeOnActionClick?: boolean;
}[],
actions: Action[],
setOpen: (open: boolean) => void = jest.fn(),
) {
return render(
Expand All @@ -23,12 +25,7 @@ export function renderComboboxAction(
>
<div>
{actions.map((action, index) => (
<ComboboxActionComponent
key={index}
label={action.label}
onClick={action.onClick}
closeOnActionClick={action.closeOnActionClick}
/>
<ComboboxActionComponent key={index} {...action} />
))}
</div>
</ComboboxContextProvider>,
Expand Down

0 comments on commit 074b99f

Please sign in to comment.