Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrancois committed Dec 9, 2024
1 parent 8630031 commit fb882ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ describe('ColumnChooser', () => {
};
});

it('should render column chooser component', () => {
it('should render column chooser component', async () => {
// when
render(
<ListContext.Provider value={defaultContext}>
<ColumnChooser id="myColumnChooser" />
<ColumnChooser id="myColumnChooser" data-testid="chooser" />
</ListContext.Provider>,
);

// then
expect(screen.getByRole('button')).toBeVisible();
act(() => screen.getByRole('button').focus()); // trigger the tooltip
expect(screen.getByText('Open the column chooser')).toBeVisible();
const btn = screen.getByLabelText('Open the column chooser');
expect(btn).toBeVisible();
await userEvent.hover(btn);
expect(screen.getByRole('tooltip')).toHaveTextContent('Open the column chooser');
});

it('should update columns', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('List DisplayMode', () => {
);

// then
act(() => screen.getAllByRole('button')[0].focus());
await userEvent.hover(screen.getAllByRole('button')[0]);
expect(screen.getByText('Set Table as current display mode.')).toBeVisible();
});

Expand Down

0 comments on commit fb882ab

Please sign in to comment.