multipleCheckboxField.spec.jsx 1015 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {MultipleCheckboxField} from 'app/components/forms';
  3. describe('MultipleCheckboxField', function () {
  4. describe('render()', function () {
  5. it('renders without form context', function () {
  6. const wrapper = mountWithTheme(
  7. <MultipleCheckboxField
  8. name="fieldName"
  9. choices={[
  10. ['1', 'On'],
  11. ['2', 'Off'],
  12. ]}
  13. value={['1']}
  14. />
  15. );
  16. expect(wrapper).toSnapshot();
  17. });
  18. it('renders with form context', function () {
  19. const wrapper = mountWithTheme(
  20. <MultipleCheckboxField
  21. name="fieldName"
  22. choices={[
  23. ['1', 'On'],
  24. ['2', 'Off'],
  25. ]}
  26. />,
  27. {
  28. context: {
  29. form: {
  30. data: {
  31. fieldName: ['1'],
  32. },
  33. errors: {},
  34. },
  35. },
  36. }
  37. );
  38. expect(wrapper).toSnapshot();
  39. });
  40. });
  41. });