bug with clear function solved

This commit is contained in:
gerard 2018-09-04 16:51:29 +02:00
parent d3406fecde
commit d991731f98
2 changed files with 4 additions and 1 deletions

View File

@ -79,6 +79,7 @@ export default class Textfield extends Input {
this.input.tabindex = value; this.input.tabindex = value;
} }
clear() { clear() {
this.saveOldValue();
this.value = null; this.value = null;
this.input.focus(); this.input.focus();
} }

View File

@ -102,11 +102,13 @@ describe('Component vnTextfield', () => {
}); });
describe('clear()', () => { 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.input, 'focus');
spyOn(controller, 'saveOldValue');
controller.clear(); controller.clear();
expect(controller.value).toEqual(null); expect(controller.value).toEqual(null);
expect(controller.saveOldValue).toHaveBeenCalledWith();
expect(controller.input.focus).toHaveBeenCalledWith(); expect(controller.input.focus).toHaveBeenCalledWith();
}); });
}); });