How to use the text-mask-addons/dist/createNumberMask.mock function in text-mask-addons

To help you get started, we’ve selected a few text-mask-addons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sumup-oss / circuit-ui / src / components / CurrencyInput / CurrencyInputService.spec.js View on Github external
it('should handle currency/locale pairs with decimal period and thousands comma separators', () => {
      const currency = 'USD';
      const locale = 'en-US';
      const expectedDecimalSymbol = '.';
      const expectedThousandsSeparatorSymbol = ',';
      createCurrencyMask(currency, locale);
      const options = createNumberMask.mock.calls[0][0];
      const actualDecimalSymbol = options.decimalSymbol;
      const actualThousandsSeparatorSymbol = options.thousandsSeparatorSymbol;
      expect(actualDecimalSymbol).toEqual(expectedDecimalSymbol);
      expect(actualThousandsSeparatorSymbol).toEqual(
        expectedThousandsSeparatorSymbol
      );
    });
github sumup-oss / circuit-ui / src / components / CurrencyInput / CurrencyInputService.spec.js View on Github external
it('should handle currency/locale pairs with no fractional part', () => {
      const currency = 'CLP';
      const locale = 'es-CL';
      const expectedAllowDecimal = false;
      const expectedDecimalLimit = 0;
      createCurrencyMask(currency, locale);
      const options = createNumberMask.mock.calls[0][0];
      const actualAllowDecimal = options.allowDecimal;
      const actualDecimalLimit = options.decimalLimit;
      expect(actualAllowDecimal).toEqual(expectedAllowDecimal);
      expect(actualDecimalLimit).toEqual(expectedDecimalLimit);
    });