genericField.spec.jsx 894 B

12345678910111213141516171819202122232425262728293031323334
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {FormState, GenericField} from 'sentry/components/deprecatedforms';
  3. describe('GenericField', function () {
  4. it('renders text as TextInput', function () {
  5. const wrapper = mountWithTheme(
  6. <GenericField
  7. formState={FormState.READY}
  8. config={{
  9. name: 'field-name',
  10. label: 'field label',
  11. type: 'text',
  12. }}
  13. />
  14. );
  15. expect(wrapper.find('TextField')).toHaveLength(1);
  16. });
  17. it('renders text with choices as SelectCreatableField', function () {
  18. const wrapper = mountWithTheme(
  19. <GenericField
  20. formState={FormState.READY}
  21. config={{
  22. name: 'field-name',
  23. label: 'field label',
  24. type: 'text',
  25. choices: [],
  26. }}
  27. />
  28. );
  29. expect(wrapper.find('SelectCreatableField')).toHaveLength(1);
  30. });
  31. });