fix(input-iban): allow formatting empty IBAN model values
This commit is contained in:
parent
03264b3704
commit
dcd7719a0f
2 changed files with 8 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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('');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue