Skip to content

Commit

Permalink
Allow to enter zero value in number field (#288)
Browse files Browse the repository at this point in the history
* Allow to enter zero value in number field

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Mikhail Volkov <[email protected]>
  • Loading branch information
asimonok and mikhail-vl authored Nov 13, 2023
1 parent 8c2ecb7 commit d48dec2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Add Disabled Text Area element type (#243)
- Add Confirmation Window options (#242)

### Bugfixes

- Allow to enter zero value in number field (#288)

## 3.2.1 (2023-09-07)

### Features / Enhancements
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/FormElements.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ describe('Form Elements', () => {
elements: [{ id: 'number', type: FormElementType.NUMBER, max: 100, value: 10 }],
getField: selectors.fieldNumber,
newValue: '',
expectedValue: null,
expectedValue: 0,
},
{
name: 'Should update with min value',
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/FormElements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const FormElements: React.FC<Props> = ({
transparent={!element.title}
>
<Input
value={element.value || ''}
value={FormatNumberValue(element.value)}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
let value = ToNumberValue(event.target.value);

Expand Down

0 comments on commit d48dec2

Please sign in to comment.