diff --git a/client/core/src/drop-down/drop-down.spec.js b/client/core/src/drop-down/drop-down.spec.js index c85bfb6b0..0927fcbd7 100644 --- a/client/core/src/drop-down/drop-down.spec.js +++ b/client/core/src/drop-down/drop-down.spec.js @@ -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()', () => {