2022-07-10 20:51:21 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
2021-06-23 20:59:06 +03:00
|
|
|
import { ShortUrlFormCheckboxGroup } from '../../../src/short-urls/helpers/ShortUrlFormCheckboxGroup';
|
|
|
|
|
|
|
|
describe('<ShortUrlFormCheckboxGroup />', () => {
|
2021-09-20 23:00:34 +03:00
|
|
|
it.each([
|
2022-03-26 14:17:42 +03:00
|
|
|
[undefined, '', 0],
|
|
|
|
['This is the tooltip', 'me-2', 1],
|
2021-06-23 20:59:06 +03:00
|
|
|
])('renders tooltip only when provided', (infoTooltip, expectedClassName, expectedAmountOfTooltips) => {
|
2022-07-10 20:51:21 +03:00
|
|
|
render(<ShortUrlFormCheckboxGroup infoTooltip={infoTooltip} />);
|
2021-06-23 20:59:06 +03:00
|
|
|
|
2022-07-10 20:51:21 +03:00
|
|
|
expect(screen.getByRole('checkbox').parentNode).toHaveAttribute(
|
|
|
|
'class',
|
|
|
|
expect.stringContaining(expectedClassName),
|
|
|
|
);
|
|
|
|
expect(screen.queryAllByRole('img', { hidden: true })).toHaveLength(expectedAmountOfTooltips);
|
2021-06-23 20:59:06 +03:00
|
|
|
});
|
|
|
|
});
|