Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
5ef97c209d
|
@ -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!
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue