Skip to content

Commit

Permalink
Fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
asimonok committed Nov 16, 2023
1 parent 97a9b30 commit 1081857
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/ElementEditor/ElementEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export const ElementEditor: React.FC<Props> = ({
onChange={(event: ChangeEvent<HTMLInputElement>) => {
onChange({
...element,
min: ToNumberValue(event.target.value),
min: event.target.value ? Number(event.target.value) : undefined,
});
}}
type="number"
Expand All @@ -311,7 +311,7 @@ export const ElementEditor: React.FC<Props> = ({
onChange={(event: ChangeEvent<HTMLInputElement>) => {
onChange({
...element,
max: ToNumberValue(event.target.value),
max: event.target.value ? Number(event.target.value) : undefined,
});
}}
type="number"
Expand Down
12 changes: 6 additions & 6 deletions src/components/FormElementsEditor/FormElementsEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ describe('Form Elements Editor', () => {
*/
const elementSelectors = openElement(newElementId, newElementType);

expect(elementSelectors.fieldNumberMin()).toHaveValue(NumberDefault.min);
expect(elementSelectors.fieldNumberMax()).toHaveValue(NumberDefault.max);
expect(elementSelectors.fieldNumberMin()).toHaveValue(null);
expect(elementSelectors.fieldNumberMax()).toHaveValue(null);
});

it('Should add Code element with default parameters', async () => {
Expand Down Expand Up @@ -996,7 +996,7 @@ describe('Form Elements Editor', () => {
expect(onChange).toHaveBeenCalledWith(
expect.arrayContaining([
expect.objectContaining({
min: null,
min: undefined,
}),
])
);
Expand Down Expand Up @@ -1036,7 +1036,7 @@ describe('Form Elements Editor', () => {
expect(onChange).toHaveBeenCalledWith(
expect.arrayContaining([
expect.objectContaining({
max: null,
max: undefined,
}),
])
);
Expand Down Expand Up @@ -1380,8 +1380,8 @@ describe('Form Elements Editor', () => {
await act(() => fireEvent.change(elementSelectors.fieldType(), { target: { value: FormElementType.NUMBER } }));

expect(elementSelectors.fieldType()).toHaveValue(FormElementType.NUMBER);
expect(elementSelectors.fieldNumberMin()).toHaveValue(NumberDefault.min);
expect(elementSelectors.fieldNumberMax()).toHaveValue(NumberDefault.max);
expect(elementSelectors.fieldNumberMin()).toHaveValue(null);
expect(elementSelectors.fieldNumberMax()).toHaveValue(null);
});

it('Should set default Code options if NewType=CODE', async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/constants/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export const SaveDefaultTextDefault = 'Save Default';
* Number Defaults
*/
export const NumberDefault: NumberOptions = {
min: null,
max: null,
value: 0,
};

Expand Down

0 comments on commit 1081857

Please sign in to comment.