diff --git a/src/utils/index.ts b/src/utils/index.ts index 81f8261ec..b13f598ef 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -305,7 +305,7 @@ export const isEmptyArray = (arr: any[]): boolean => { export const interpolate = (template: string, values: Record): string => { return template.replace(/\{([^}]+)\}/g, (_, p): string => { - return values[p] || `{${p}}`; + return p in values ? values[p] : `{${p}}`; }); }; diff --git a/tests/providers/provider.js b/tests/providers/provider.js index c6d88b209..e8bfabd8a 100644 --- a/tests/providers/provider.js +++ b/tests/providers/provider.js @@ -327,7 +327,7 @@ test('validates on rule change: testing NaN', async () => { // flush the pending validation. await flushPromises(); - expect(error.text()).toBe('The {field} field may not be greater than {length} characters'); + expect(error.text()).toBe('The {field} field may not be greater than NaN characters'); wrapper.vm.rules = { required: true, @@ -335,7 +335,7 @@ test('validates on rule change: testing NaN', async () => { }; await flushPromises(); - expect(error.text()).toBe('The {field} field may not be greater than {length} characters'); + expect(error.text()).toBe('The {field} field may not be greater than NaN characters'); }); test('validates components on input by default', async () => {