multipleCheckboxField.spec.jsx 913 B

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