Bug #312 Autocomplete intenta mostrar el valor antes de tener los datos

This commit is contained in:
gerard 2018-07-02 13:13:26 +02:00
parent c123207ac2
commit 3bca15708f
2 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,15 @@ export default class Autocomplete extends Input {
this.element.querySelector('.mdl-textfield'));
}
set url(value) {
this._url = value;
this.refreshSelection();
}
get url() {
return this._url;
}
/**
* @type {any} The autocomplete value.
*/

View File

@ -21,6 +21,16 @@ describe('Component vnAutocomplete', () => {
controller = _$componentController_('vnAutocomplete', {$element, $scope, $httpBackend, $transclude: null});
}));
describe('url() setter', () => {
it(`should set url controllers property and call refreshSelection`, () => {
spyOn(controller, "refreshSelection");
controller.url = "url";
expect(controller.url).toEqual("url");
expect(controller.refreshSelection).toHaveBeenCalledWith();
});
});
describe('field() setter/getter', () => {
it(`should set field controllers property`, () => {
controller.field = data.id;