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

feat(input): Add input tests with number type #143

Merged
merged 3 commits into from
Sep 16, 2021

Conversation

yasincaliskan
Copy link
Contributor

Description

Add Input tests with number type

  • Localization
  • maximumFractionDigits consistency
  • Removing leading zero
  • Entering letter
  • Converting scientific notation
  • Formatting locale string

@mucahit mucahit added Ready for new release PR is reviewed and ready to be merged and removed ready for review labels Aug 19, 2021
Copy link
Contributor

@edizcelik edizcelik left a 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.

Comment on lines 149 to 151
userEvent.type(input, "-0");

expect(input).toHaveValue(undefined);
Copy link
Contributor

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.

Copy link
Contributor Author

@yasincaliskan yasincaliskan Sep 9, 2021

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!

@edizcelik edizcelik removed the Ready for new release PR is reviewed and ready to be merged label Aug 26, 2021
@mucahit mucahit merged commit 833c581 into feat/initialize-tests Sep 16, 2021
@mucahit mucahit deleted the feat/number-input-tests branch September 16, 2021 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants