Skip to content

Commit

Permalink
fix(components/autonumeric): support negativeBracketsTypeOnBlur option (
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhwhite authored Jan 22, 2025
1 parent d46eba5 commit 7baecf7
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 @@ -148,9 +148,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 7baecf7

Please sign in to comment.