-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(input): Add input tests with number type #143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to write unit tests for the utility functions we use within number input.
Also, I tried number inputs on this link and I noticed we have problems when users try to type some negative numbers. For example, we can't write -1
. Instead, it writes 1 and then you need to change the location of cursor to put -
sign. Then you cant remove the input value, it gets stuck at -1
.
src/form/input/input.test.tsx
Outdated
userEvent.type(input, "-0"); | ||
|
||
expect(input).toHaveValue(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different from the behaviour of the number input. When user type -0
, the input value becomes 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If maximumFractionDigits
prop is zero, the user can't type 0 after the minus sign. However, you're right. In this case, -0
turns to 0
makes more sense. I fixed this. Thank you!
Description
Add Input tests with number type
maximumFractionDigits
consistency