Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow input field to have zero value #1647

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ describe('<Input>', () => {

expect(onKeyDown).toHaveBeenCalledTimes(1)
})

it('should render a field with value zero', () => {
const screen = render(
<InputField label="label" name="foo" type="number" value={0} />
)

expect(screen.getByLabelText('label')).toHaveValue(0)
})
})
2 changes: 1 addition & 1 deletion components/input/src/input-field/input-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class InputField extends React.Component {
onChange={onChange}
name={name}
type={type}
value={value || ''}
value={value ?? ''}
placeholder={placeholder}
disabled={disabled}
max={max}
Expand Down
Loading