-
Notifications
You must be signed in to change notification settings - Fork 205
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(number-field): handles values greater than 1000 #4417
Conversation
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
Tachometer resultsChromenumber-field permalinkbasic-test
slider permalinktest-basic
Firefoxnumber-field permalinkbasic-test
slider permalinktest-basic
|
describe('it handles values greater than 1000', () => { | ||
it('correctly handles values greater than 1000 with step=1', async () => { |
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.
Can we bump this test up into the describe('Step', () => {
block so we don't need the new describe
, please.
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.
Corrected this on behalf of @blunteshwar.
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.
Many thanks for the quick turn around on this.
Thanks for the fast fix! |
* fix(number-field): handles values greater than 1000 * chore(number-field): updated tests --------- Co-authored-by: Rajdeep Chandra <rajdeepchandra@Rajdeeps-MacBook-Pro-2.local>
Description
This PR addresses an issue where large numbers were being incorrectly formatted or rounded in the valueFormatter of the component. The problem was occurring due to the default behavior of the NumberFormatter which was using grouping for large numbers. This caused values greater than 1000 to be formatted incorrectly.
Changes Made:
Added the
useGrouping: false
option to the NumberFormatter instantiation in the valueFormatter method.This change ensures that large numbers are formatted without grouping, preventing the rounding or truncation issues observed previously.
Related issue(s)
Motivation and context
This fix improves the accuracy of number formatting for large numbers in the component, ensuring that they are displayed correctly to the user.
How has this been tested?
Tested the fix with various large numbers and confirmed that they are now formatted correctly without any rounding or truncation.
Checked that the formatting behavior for numbers less than 1000 remains unchanged.
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.