2021-06-23 20:59:06 +03:00
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import { ShortUrlFormCheckboxGroup } from '../../../src/short-urls/helpers/ShortUrlFormCheckboxGroup';
|
|
|
|
import Checkbox from '../../../src/utils/Checkbox';
|
2021-08-22 12:05:07 +03:00
|
|
|
import { InfoTooltip } from '../../../src/utils/InfoTooltip';
|
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) => {
|
|
|
|
const wrapper = shallow(<ShortUrlFormCheckboxGroup infoTooltip={infoTooltip} />);
|
|
|
|
const checkbox = wrapper.find(Checkbox);
|
|
|
|
|
|
|
|
expect(checkbox.prop('className')).toEqual(expectedClassName);
|
2021-08-22 12:05:07 +03:00
|
|
|
expect(wrapper.find(InfoTooltip)).toHaveLength(expectedAmountOfTooltips);
|
2021-06-23 20:59:06 +03:00
|
|
|
});
|
|
|
|
});
|