2022-07-10 20:51:21 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
2023-07-24 21:14:59 +03:00
|
|
|
import { ShortUrlFormCheckboxGroup } from '../../../shlink-web-component/short-urls/helpers/ShortUrlFormCheckboxGroup';
|
2021-06-23 20:59:06 +03:00
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|