bug with clear function solved
This commit is contained in:
parent
d3406fecde
commit
d991731f98
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue