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(input, input-number): decimals no longer contain groupSeparators and remove leading zeros #5490

Merged
merged 10 commits into from
Nov 16, 2022

Conversation

benelan
Copy link
Member

@benelan benelan commented Oct 17, 2022

Related Issue: #5763

Repro sample: https://codepen.io/benesri/pen/zYaZaGX

Summary

This fixes a bug caused by adding the numberingSystem property to components. We have to format the integers and decimals separately since we support yuuge numbers using the BigDecimal class. This caused long decimal numbers to have group separators, which I fixed by formatting each digit individually. It also caused leading zeros in decimals to be removed, e.g. 0.00123 became 0.123.

I also did some small cleanup in BigDecimal like caching regex and removing duplicate code

@benelan benelan requested a review from a team as a code owner October 17, 2022 18:38
@github-actions github-actions bot added the refactor Issues tied to code that needs to be significantly reworked. label Oct 17, 2022
@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Oct 25, 2022
@benelan benelan added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Nov 8, 2022
@benelan benelan added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Nov 8, 2022
@github-actions github-actions bot added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Nov 8, 2022
@benelan benelan added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Nov 8, 2022
@benelan benelan added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Nov 8, 2022
* master: (32 commits)
  1.0.0-next.627
  build(deps): bump semver-regex and screener-storybook (#5741)
  build(deps): bump stylelint-config-recommended-scss from 7.0.0 to 8.0.0 (#5551)
  build(deps): bump parse-path and @storybook/storybook-deployer (#5692)
  build(deps): bump tailwindcss from 3.1.8 to 3.2.2 (#5708)
  ci(pr-bot): check user login for dependabot instead of actor (#5740)
  build(deps): bump postcss from 8.4.17 to 8.4.18 (#5508)
  build(deps): bump concurrently from 7.4.0 to 7.5.0 (#5550)
  build(deps): bump loader-utils from 1.4.0 to 1.4.1 (#5704)
  build(deps): bump @typescript-eslint/parser from 5.40.1 to 5.42.1 (#5707)
  test(value-list): Skip unstable test. (#5738)
  ci(pr-bot): skip assignment for dependabot PRs (#5737)
  chore(t9manifest): Fix newline at end of file. (#5718)
  fix(flow-item): Position back tooltip above (#5688)
  feat(popover): Escape key should close open popovers. (#5726)
  docs: update component READMEs (#5545)
  fix(value-list-item): Prevent scrolling when space is pressed on drag button (#5709)
  ci(output targets): move patches to postbuild to include them in CCR (#5730)
  1.0.0-next.626
  fix(button, fab): adjust padding on 'l' scale button to accommodate 'm' scale icon without change in height (#5659)
  ...
@benelan benelan changed the title refactor(BigDecimal): remove repeat code and cache regex fix(input, input-number): long decimals no longer contain groupSeparators Nov 11, 2022
@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Nov 14, 2022
@benelan benelan removed refactor Issues tied to code that needs to be significantly reworked. Stale Issues or pull requests that have not had recent activity. labels Nov 14, 2022
@benelan benelan changed the title fix(input, input-number): long decimals no longer contain groupSeparators fix(input, input-number): long decimals no longer contain groupSeparators and remove leading zeros Nov 16, 2022
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
✨🔢✨✨✨🔢✨🔢🔢🔢✨✨🔢🔢🔢✨🔢🔢🔢🔢✨🔢✨
✨🔢🔢✨✨🔢✨✨🔢✨✨🔢✨✨✨✨🔢✨✨✨✨🔢✨
✨🔢✨🔢✨🔢✨✨🔢✨✨🔢✨✨✨✨🔢🔢🔢✨✨🔢✨
✨🔢✨✨🔢🔢✨✨🔢✨✨🔢✨✨✨✨🔢✨✨✨✨✨✨
✨🔢✨✨✨🔢✨🔢🔢🔢✨✨🔢🔢🔢✨🔢🔢🔢🔢✨🔢✨
✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨

@@ -35,7 +36,7 @@ describe("NumberStringFormat", () => {
});

locales.forEach((locale) => {
it(`integers localize and delocalize in "${locale}"`, () => {
it(`locale: integers localize and delocalize in "${locale}"`, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could place these in a describe("locale", () => { /*...*/ block for grouping instead of updating the individual test names.

* master: (24 commits)
  1.0.0-next.632
  feat(pick-list, value-list): Add calciteListFilter event, filteredItems prop, filterText prop and filteredData prop. (#5681)
  fix(block, date-picker, list-item-group, panel, pick-list-group, popover, tip, tip-manager)!: Set default internal heading to a div. (#5728)
  refactor(modal): Update modal to use focus-trap module. (#5676)
  1.0.0-next.631
  fix(input-date-picker): restores mouse clicks on date-picker popup (#5760)
  build(deps): bump loader-utils from 1.4.1 to 1.4.2 (#5764)
  ci(product-label): fix version syntax and use os agnostic newline char (#5762)
  1.0.0-next.630
  ci(pr-bot): don't label dependabot PRs (#5759)
  build(deps): bump chromatic from 6.7.1 to 6.11.4 (#5756)
  fix(combobox): Wrap and break text on long items (#5672)
  build(deps): bump @storybook/addon-interactions from 6.5.9 to 6.5.13 (#5753)
  build(deps): bump type-fest from 3.1.0 to 3.2.0 (#5752)
  build(deps): bump @storybook/addon-a11y from 6.5.12 to 6.5.13 (#5754)
  build(deps): bump postcss from 8.4.18 to 8.4.19 (#5755)
  ci: add chromatic (#5733)
  build(docs): generate docs-json for afd usage (#5748)
  1.0.0-next.629
  fix(inline-editable): Add text-ellipsis when not editing (#5679)
  ...
@benelan benelan changed the title fix(input, input-number): long decimals no longer contain groupSeparators and remove leading zeros fix(input, input-number): decimals no longer contain groupSeparators and remove leading zeros Nov 16, 2022
@benelan benelan added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Nov 16, 2022
@benelan benelan merged commit 07142f3 into master Nov 16, 2022
@benelan benelan deleted the benelan/cleanup-big-decimal branch November 16, 2022 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants