[WC-3322]: Fix slider decimal places formatting#2220
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
4e14487 to
945997f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
945997f to
98f491a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
07fc177 to
691462a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
fce3bc3 to
955eda7
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI checks: could not be fetched in this environment — please verify they are green before merging. Findings
|
955eda7 to
0fbf863
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI status at review time: Findings
|
0fbf863 to
457a610
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings
|
…eparator Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
457a610 to
5a05fd6
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI check results: could not retrieve (requires manual approval in this environment) Findings🔶 Medium —
|
Replace manual toFixed + decimal-separator swapping with the value attribute's own Mendix NumberFormatter, overriding only decimalPrecision via withConfig. The locale decimal separator and thousands grouping now follow the user's session locale and the attribute's groupDigits setting automatically. Mark keys remain rounded with parseFloat(rawValue.toFixed(dp)) (always "." based, locale-safe) so rc-slider positions dots where their labels read. Fix E2E context expectations to match the model's decimalPlaces=1 output (0.0 / 20.0). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
When
decimalPlacesis configured on the Slider widget, displayed values were silently stripping trailing zeros:10.00rendered as10,9.20rendered as9.2Root causes:
marks.ts—parseFloat(value.toFixed(n)).toString()round-tripped through a number, discarding trailing zeros. Fixed by keeping thetoFixedstring directly as the label and usingparseFloatonly for the numeric key.createHandleRender.tsx— tooltip overlay receivedrestProps.value(raw RC Slider number). Fixed by adding adecimalPlacesparameter and applying.toFixed(decimalPlaces)before passing to the overlay.Files changed:
src/utils/marks.ts— fix label generationsrc/utils/createHandleRender.tsx— accept and applydecimalPlacessrc/components/Container.tsx— passdecimalPlacestocreateHandleRendersrc/utils/__tests__/marks.spec.ts— new unit testssrc/utils/__tests__/createHandleRender.spec.tsx— new unit testsWhat should be covered while testing?
decimalPlaces = 2andNumber of markers > 0.0.00,5.00,10.00— not0,5,10.10.00, not10.9.50.decimalPlaces = 0and verify no change in existing behavior (labels and tooltip show integers without decimal point).