mirror of
https://github.com/apache/superset.git
synced 2024-09-07 06:17:45 -04:00
test: Fixes act errors in PopoverSection test (#21416)
This commit is contained in:
parent
a5e1811ee4
commit
5d1afbcfb2
@ -21,23 +21,23 @@ import { render, screen } from 'spec/helpers/testing-library';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import PopoverSection from 'src/components/PopoverSection';
|
import PopoverSection from 'src/components/PopoverSection';
|
||||||
|
|
||||||
test('renders with default props', () => {
|
test('renders with default props', async () => {
|
||||||
render(
|
render(
|
||||||
<PopoverSection title="Title">
|
<PopoverSection title="Title">
|
||||||
<div role="form" />
|
<div role="form" />
|
||||||
</PopoverSection>,
|
</PopoverSection>,
|
||||||
);
|
);
|
||||||
expect(screen.getByRole('form')).toBeInTheDocument();
|
expect(await screen.findByRole('form')).toBeInTheDocument();
|
||||||
expect(screen.getAllByRole('img').length).toBe(1);
|
expect((await screen.findAllByRole('img')).length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('renders tooltip icon', () => {
|
test('renders tooltip icon', async () => {
|
||||||
render(
|
render(
|
||||||
<PopoverSection title="Title" info="Tooltip">
|
<PopoverSection title="Title" info="Tooltip">
|
||||||
<div role="form" />
|
<div role="form" />
|
||||||
</PopoverSection>,
|
</PopoverSection>,
|
||||||
);
|
);
|
||||||
expect(screen.getAllByRole('img').length).toBe(2);
|
expect((await screen.findAllByRole('img')).length).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('renders a tooltip when hovered', async () => {
|
test('renders a tooltip when hovered', async () => {
|
||||||
@ -50,13 +50,13 @@ test('renders a tooltip when hovered', async () => {
|
|||||||
expect(await screen.findByRole('tooltip')).toBeInTheDocument();
|
expect(await screen.findByRole('tooltip')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('calls onSelect when clicked', () => {
|
test('calls onSelect when clicked', async () => {
|
||||||
const onSelect = jest.fn();
|
const onSelect = jest.fn();
|
||||||
render(
|
render(
|
||||||
<PopoverSection title="Title" onSelect={onSelect}>
|
<PopoverSection title="Title" onSelect={onSelect}>
|
||||||
<div role="form" />
|
<div role="form" />
|
||||||
</PopoverSection>,
|
</PopoverSection>,
|
||||||
);
|
);
|
||||||
userEvent.click(screen.getByRole('img'));
|
userEvent.click(await screen.findByRole('img'));
|
||||||
expect(onSelect).toHaveBeenCalled();
|
expect(onSelect).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user