2022-05-11 20:18:43 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
import userEvent from '@testing-library/user-event';
|
2022-05-02 19:54:19 +03:00
|
|
|
import { UseExistingIfFoundInfoIcon } from '../../src/short-urls/UseExistingIfFoundInfoIcon';
|
2019-03-17 20:14:36 +03:00
|
|
|
|
|
|
|
describe('<UseExistingIfFoundInfoIcon />', () => {
|
2022-05-02 19:54:19 +03:00
|
|
|
it('shows modal when icon is clicked', async () => {
|
2022-05-11 20:18:43 +03:00
|
|
|
const user = userEvent.setup();
|
2022-05-02 19:54:19 +03:00
|
|
|
render(<UseExistingIfFoundInfoIcon />);
|
2019-03-17 20:14:36 +03:00
|
|
|
|
2022-05-02 19:54:19 +03:00
|
|
|
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
2022-05-11 20:18:43 +03:00
|
|
|
await user.click(screen.getByTitle('What does this mean?').firstElementChild as Element);
|
2022-05-02 19:54:19 +03:00
|
|
|
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
2019-03-17 20:14:36 +03:00
|
|
|
});
|
|
|
|
});
|