checkboxFancy.spec.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import CheckboxFancy from 'app/components/checkboxFancy/checkboxFancy';
  3. describe('CheckboxFancy', function () {
  4. it('renders', function () {
  5. const wrapper = mountWithTheme(<CheckboxFancy />);
  6. expect(wrapper).toSnapshot();
  7. });
  8. it('isChecked', function () {
  9. const wrapper = mountWithTheme(<CheckboxFancy isChecked />);
  10. expect(wrapper.props().isChecked).toEqual(true);
  11. expect(wrapper.find('[data-test-id="icon-check-mark"]').exists()).toEqual(true);
  12. expect(wrapper.find('[data-test-id="icon-subtract"]').exists()).toEqual(false);
  13. });
  14. it('isIndeterminate', function () {
  15. const wrapper = mountWithTheme(<CheckboxFancy isIndeterminate />);
  16. expect(wrapper.props().isIndeterminate).toEqual(true);
  17. expect(wrapper.find('[data-test-id="icon-check-mark"]').exists()).toEqual(false);
  18. expect(wrapper.find('[data-test-id="icon-subtract"]').exists()).toEqual(true);
  19. });
  20. it('isDisabled', function () {
  21. const wrapper = mountWithTheme(<CheckboxFancy isDisabled />);
  22. expect(wrapper.props().isDisabled).toEqual(true);
  23. expect(wrapper.find('[data-test-id="icon-check-mark"]').exists()).toEqual(false);
  24. expect(wrapper.find('[data-test-id="icon-subtract"]').exists()).toEqual(false);
  25. });
  26. });