diff --git a/projects/kit/src/lib/masks/number/number-mask.ts b/projects/kit/src/lib/masks/number/number-mask.ts index a882c268f..5b3861dbf 100644 --- a/projects/kit/src/lib/masks/number/number-mask.ts +++ b/projects/kit/src/lib/masks/number/number-mask.ts @@ -81,6 +81,7 @@ export function maskitoNumberOptionsGenerator({ isNegativeAllowed: min < 0, }), preprocessors: [ + createFullWidthToHalfWidthPreprocessor(), createInitializationOnlyPreprocessor({ decimalSeparator, decimalPseudoSeparators: validatedDecimalPseudoSeparators, @@ -89,7 +90,6 @@ export function maskitoNumberOptionsGenerator({ postfix, }), createAffixesFilterPreprocessor({prefix, postfix}), - createFullWidthToHalfWidthPreprocessor(), createPseudoCharactersPreprocessor({ validCharacter: CHAR_MINUS, pseudoCharacters: pseudoMinuses, diff --git a/projects/kit/src/lib/masks/number/tests/number-mask.spec.ts b/projects/kit/src/lib/masks/number/tests/number-mask.spec.ts index 8f945f6d0..28e94e7e3 100644 --- a/projects/kit/src/lib/masks/number/tests/number-mask.spec.ts +++ b/projects/kit/src/lib/masks/number/tests/number-mask.spec.ts @@ -297,4 +297,25 @@ describe('Number (maskitoTransform)', () => { }); }); }); + + describe('should transform full width number to half width', () => { + describe('at any time', () => { + it('at the 1st time (after initialization)', () => { + const options = maskitoNumberOptionsGenerator({ + thousandSeparator: '_', + }); + + expect(maskitoTransform('12345', options)).toBe('12_345'); + }); + + it('at the 2nd time (after initialization)', () => { + const options = maskitoNumberOptionsGenerator({ + thousandSeparator: '_', + }); + + maskitoTransform('12345', options); + expect(maskitoTransform('12345', options)).toBe('12_345'); + }); + }); + }); });