Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Added truncate and truncateAfter options to numeric pipe #1823

Conversation

Blackbaud-JacobWood
Copy link

To be consumed by future currency input control in development
Resolves: #1643

To be consumed by future currency input control in development
Resolves: blackbaud#1643
@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: ce8bf1f
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/403527694

(Please note that this is a fully automated comment.)

@codecov-io
Copy link

codecov-io commented Jul 13, 2018

Codecov Report

Merging #1823 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1823      +/-   ##
==========================================
- Coverage   99.98%   99.98%   -0.01%     
==========================================
  Files         410      411       +1     
  Lines        8592     8535      -57     
  Branches     1269     1256      -13     
==========================================
- Hits         8591     8534      -57     
  Misses          1        1
Impacted Files Coverage Δ
src/modules/numeric/numeric.options.ts 100% <100%> (ø) ⬆️
src/modules/numeric/numeric.service.ts 100% <100%> (ø) ⬆️
src/modules/numeric/numeric.pipe.ts 100% <100%> (ø)
...modules/colorpicker/colorpicker-input.directive.ts 98.95% <0%> (-0.05%) ⬇️
src/modules/dropdown/dropdown.component.ts 100% <0%> (ø) ⬆️
...c/modules/datepicker/datepicker-input.directive.ts 100% <0%> (ø) ⬆️
src/modules/timepicker/timepicker.directive.ts 100% <0%> (ø) ⬆️
src/modules/tabs/tabset.component.ts 100% <0%> (ø) ⬆️
src/modules/sort/sort.module.ts 100% <0%> (ø) ⬆️
src/modules/flyout/flyout.component.ts 100% <0%> (ø) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4786309...899ef89. Read the comment docs.

1234567 without truncation
</sky-definition-list-label>
<sky-definition-list-value>
{{1234567 | skyNumeric:{truncate: false} }}

Choose a reason for hiding this comment

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

This produced the following:

screen shot 2018-07-13 at 12 27 58 pm

Is that expected, or should it just be 1,234,567?

Choose a reason for hiding this comment

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

I didn’t mess with the default for the digits option which is 1 in the NumericOptions class. When not truncating a decimal, the min and max fraction value are both set to that digits option so as to not mess with the output.

@Blackbaud-JacobWood
Copy link
Author

Blackbaud-JacobWood commented Jul 16, 2018 via email

15501 with truncation after 10000 and 1 digit
</sky-definition-list-label>
<sky-definition-list-value>
{{15501 | skyNumeric:{digits: 1, truncateAfter: 10000} }}

Choose a reason for hiding this comment

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

@Blackbaud-JacobWood If I change truncateAfter to 1000, the result doesn't change. Is that expected?

Choose a reason for hiding this comment

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

Yes, original affects of the this component would only occur when the value is greater than the truncateAfter, with 15501 being greater than both 1000 and 10000 they would be the same. When set to 10000, the value 9999 should not be truncated.

Choose a reason for hiding this comment

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

I gotcha, thanks for the explanation!

@Blackbaud-SteveBrush
Copy link
Member

Closing in favor of: #1856

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 899ef89
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/408075719

(Please note that this is a fully automated comment.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants