lion/packages/input-amount/test/preprocessors.test.js
Joren Broekema 13f808af57 feat: add preprocessor hook and example amount preprocessor
Co-authored-by: Thijs Louisse <Thijs.Louisse@ing.com>
2021-03-22 09:43:32 +01:00

16 lines
499 B
JavaScript

import { expect } from '@open-wc/testing';
import { preprocessAmount } from '../src/preprocessors.js';
describe('preprocessAmount()', () => {
it('preprocesses numbers to filter out non-digits', async () => {
expect(preprocessAmount('123as@dh2^!#')).to.equal('1232');
});
it('does not filter out separator characters', async () => {
expect(preprocessAmount('123 456,78.90')).to.equal(
'123 456,78.90',
'Dot, comma and space should not be filtered out.',
);
});
});