added test to dropDown

This commit is contained in:
Daniel Herrero 2017-11-30 10:16:33 +01:00
parent ea9c5f3457
commit 7d8c28f9d3
1 changed files with 12 additions and 1 deletions

View File

@ -300,7 +300,7 @@ describe('Component vnDropDown', () => {
expect(controller.show).toEqual(true);
});
it(`should call loadMore() and then set controller._show to true`, () => {
it(`should call loadMore() and then set controller._show to true if there are items`, () => {
controller.showLoadMore = () => {};
controller.loadMore = () => {};
spyOn(controller, 'loadMore');
@ -310,6 +310,17 @@ describe('Component vnDropDown', () => {
expect(controller._show).toEqual(true);
expect(controller.loadMore).toHaveBeenCalledWith();
});
it(`should call loadMore() and then set controller._show to undefined if there are not items`, () => {
controller.showLoadMore = () => {};
controller.loadMore = () => {};
spyOn(controller, 'loadMore');
controller.itemsFiltered = [];
controller.loadItems();
expect(controller._show).not.toBeDefined();
expect(controller.loadMore).toHaveBeenCalledWith();
});
});
describe('$onInit()', () => {