Merge pull request #57 from ing-bank/fix/ibanFormatter

fix(input-iban): allow formatting empty IBAN model values
This commit is contained in:
Mikhail Bashkirov 2019-05-21 10:46:52 -04:00 committed by GitHub
commit 134cd1ed01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -7,5 +7,9 @@ import { friendlyFormatIBAN } from '@bundled-es-modules/ibantools';
* @return {string} formatted value
*/
export function formatIBAN(modelValue) {
// defensive code because of ibantools
if (modelValue === '') {
return '';
}
return friendlyFormatIBAN(modelValue);
}

View file

@ -6,4 +6,8 @@ describe('formatIBAN', () => {
it('formats the IBAN', () => {
expect(formatIBAN('NL17INGB0002822608')).to.equal('NL17 INGB 0002 8226 08');
});
it('returns `` if no value is given', () => {
expect(formatIBAN('')).to.equal('');
});
});