checkboxFancy.spec.tsx 1.3 KB

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