diff --git a/client/core/src/autocomplete/autocomplete.spec.js b/client/core/src/autocomplete/autocomplete.spec.js index 8999e25b0..0f31b5d96 100644 --- a/client/core/src/autocomplete/autocomplete.spec.js +++ b/client/core/src/autocomplete/autocomplete.spec.js @@ -171,7 +171,7 @@ describe('Component vnAutocomplete', () => { expect(controller.items.length).toEqual(2); }); - it(`should perform a query with the search value if the finding flag is false`, () => { + it(`should perform a search and store the result in controller items`, () => { let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}, {url: 'test.com'}); let search = 'The Joker'; let json = JSON.stringify({where: {name: {regexp: search}}}); @@ -183,18 +183,17 @@ describe('Component vnAutocomplete', () => { expect(controller.items[0]).toEqual({id: 3, name: 'The Joker'}); }); - it(`should perform a query with the search value if the finding flag is false`, () => { + it(`should perform a search with multiple true and store the result in controller items with the checked property defined`, () => { let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}, {url: 'test.com'}); - let search = 'The Joker'; + let search = 'Joker'; + controller.multiple = true; let json = JSON.stringify({where: {name: {regexp: search}}}); - $httpBackend.whenGET(`test.com?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); + $httpBackend.whenGET(`test.com?filter=${json}`).respond([{id: 3, name: 'The Joker'}, {id: 4, name: 'Joker'}]); $httpBackend.expectGET(`test.com?filter=${json}`); controller.findItems(search); $httpBackend.flush(); - expect(controller.items[0]).toEqual({id: 3, name: 'The Joker'}); + expect(controller.items).toEqual([{id: 3, name: 'The Joker', checked: false}, {id: 4, name: 'Joker', checked: false}]); }); - - // siguiente test el de Multiple! }); });