diff --git a/client/core/src/components/textfield/textfield.js b/client/core/src/components/textfield/textfield.js index 7b1382b79..64b91faa0 100644 --- a/client/core/src/components/textfield/textfield.js +++ b/client/core/src/components/textfield/textfield.js @@ -79,6 +79,7 @@ export default class Textfield extends Input { this.input.tabindex = value; } clear() { + this.saveOldValue(); this.value = null; this.input.focus(); } diff --git a/client/core/src/components/textfield/textfield.spec.js b/client/core/src/components/textfield/textfield.spec.js index c21c62d84..68e3648bb 100644 --- a/client/core/src/components/textfield/textfield.spec.js +++ b/client/core/src/components/textfield/textfield.spec.js @@ -102,11 +102,13 @@ describe('Component vnTextfield', () => { }); describe('clear()', () => { - it(`should set value property to null and call focus`, () => { + it(`should set value property to null, call focus and saveOldValue`, () => { spyOn(controller.input, 'focus'); + spyOn(controller, 'saveOldValue'); controller.clear(); expect(controller.value).toEqual(null); + expect(controller.saveOldValue).toHaveBeenCalledWith(); expect(controller.input.focus).toHaveBeenCalledWith(); }); });