client side unit test for autocomplete field() > setValue()

This commit is contained in:
Carlos 2017-09-27 09:42:59 +02:00
parent 79438f31cb
commit 9ae7898c19
1 changed files with 7 additions and 13 deletions

View File

@ -75,24 +75,18 @@ describe('Component vnAutocomplete', () => {
}); });
}); });
describe('when value is not an object', () => { // not sure if it isnt an object actually describe('when value is not an object', () => {
it(`should set _field value`, () => { it(`should set _field value`, () => {
let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout});
controller.valueField = 'name'; controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}];
controller.items = [{name: 'test1'}, {name: 'test2'}]; controller.field = 2;
// controller.field = 6; puede ser cualquier cosa
// // request datasources.development.json to Vicente to carry on expect(controller._field).toEqual(2);
// // let json = find out the value of json stringify expect(controller._multiField).toEqual([]);
// // let url = find out the url for get endpoint
// controller.field = {name: 'Bruce Wayne'}; controller.field = {id: 3, name: 'The Joker'};
// // same URL for requests expect(controller._field).toEqual(3);
// $httpBackend.when('GET', `localhost:5000?filter=Bruce`).respond('done');
// $httpBackend.expectGET(`localhost:5000?filter=Bruce`, {name: 'Bruce Wayne'});
// // any value to be defined before the flush?
// $httpBackend.flush();
}); });
}); });
}); });