Skip to content

Commit

Permalink
fix(components/autonumeric): support negativeBracketsTypeOnBlur option (
Browse files Browse the repository at this point in the history
#3049) (#3050)

🍒 Cherry picked from #3049 [fix(components/autonumeric):
support negativeBracketsTypeOnBlur
option](#3049)


[AB#3230187](https://dev.azure.com/blackbaud/f565481a-7bc9-4083-95d5-4f953da6d499/_workitems/edit/3230187)

Co-authored-by: John White <[email protected]>
  • Loading branch information
blackbaud-sky-build-user and johnhwhite authored Jan 22, 2025
1 parent 22f24a4 commit 6116a0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,22 @@ describe('Autonumeric directive', () => {
expect(formattedValue).toEqual('1,000.00000');
}));

it('should support negativeBracketsTypeOnBlur', fakeAsync(() => {
setOptions({
currencySymbol: '$',
decimalPlaces: 2,
negativeBracketsTypeOnBlur: '(,)',
});

setValue(1000);

const modelValue = getModelValue();
const formattedValue = getFormattedValue();

expect(modelValue).toEqual(1000);
expect(formattedValue).toEqual('$1,000.00');
}));

it('should update numeric value on keyup', fakeAsync(() => {
detectChangesTick();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ export class SkyAutonumericDirective

if (typeof value === 'number') {
if (this.skyAutonumericFormChangesUnformatted) {
this.#autonumericInstance.setUnformatted(value);
this.#autonumericInstance.setUnformatted(value.toString());
} else {
this.#autonumericInstance.set(value);
this.#autonumericInstance.set(value.toString());
}
} else {
this.#autonumericInstance.clear();
Expand Down

0 comments on commit 6116a0f

Please sign in to comment.