Skip to content

Commit

Permalink
do no longer use the numfields from uniforms for number fields. They …
Browse files Browse the repository at this point in the history
…are clumsy to use from a UX perspective and we lose the ability to put in property placeholders
  • Loading branch information
lhein committed Nov 30, 2023
1 parent f0899f0 commit 08e5a38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
14 changes: 3 additions & 11 deletions packages/ui/src/components/Form/CustomAutoField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ jest.mock('uniforms', () => {
};
});

import {
BoolField,
DateField,
ListField,
NumField,
RadioField,
SelectField,
TextField,
} from '@kaoto-next/uniforms-patternfly';
import { BoolField, DateField, ListField, RadioField, SelectField, TextField } from '@kaoto-next/uniforms-patternfly';
import { AutoFieldProps } from 'uniforms';
import { CustomAutoField } from './CustomAutoField';
import { CustomNestField } from './CustomNestField';
Expand Down Expand Up @@ -93,15 +85,15 @@ describe('CustomAutoField', () => {
expect(result).toBe(DateField);
});

it('should return `NumField` if `props.fieldType` is `Number`', () => {
it('should return `TextField` if `props.fieldType` is `Number`', () => {
const props: AutoFieldProps = {
name: 'test',
fieldType: Number,
};

const result = CustomAutoField(props);

expect(result).toBe(NumField);
expect(result).toBe(TextField);
});

it('should return `CustomNestField` if `props.fieldType` is `Object`', () => {
Expand Down
12 changes: 2 additions & 10 deletions packages/ui/src/components/Form/CustomAutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
BoolField,
DateField,
ListField,
NumField,
RadioField,
SelectField,
TextField,
} from '@kaoto-next/uniforms-patternfly';
import { BoolField, DateField, ListField, RadioField, SelectField, TextField } from '@kaoto-next/uniforms-patternfly';
import { createAutoField } from 'uniforms';
import { CustomNestField } from './CustomNestField';
import { DisabledField } from './DisabledField';
Expand Down Expand Up @@ -39,7 +31,7 @@ export const CustomAutoField = createAutoField((props) => {
case Date:
return DateField;
case Number:
return NumField;
return TextField;
case Object:
return CustomNestField;
case String:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('PipeErrorHandlerEditor', () => {
render(<PipeErrorHandlerEditor model={model} onChangeModel={() => {}} schema={pipeErrorHandlerSchema} />);
const element = screen.getByTestId('metadata-editor-form-Log Pipe ErrorHandler');
expect(element).toBeTruthy();
const inputs = screen.getAllByTestId('num-field');
const inputs = screen.getAllByTestId('text-field');
expect(inputs.length).toBe(2);
expect(inputs[0].getAttribute('name')).toBe('log.parameters.maximumRedeliveries');
expect(inputs[1].getAttribute('name')).toBe('log.parameters.redeliveryDelay');
Expand Down

0 comments on commit 08e5a38

Please sign in to comment.