Fix if-check

This commit is contained in:
Dicker Max 2018-08-16 15:27:56 +00:00 committed by Fatih Acet
parent 7a0e2426bc
commit c4d2db1f6c
3 changed files with 15 additions and 1 deletions

View file

@ -203,7 +203,7 @@ export default {
this.showIssueForm = !this.showIssueForm;
},
onScroll() {
if (!this.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
if (!this.list.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
this.loadNextPage();
}
},

View file

@ -0,0 +1,5 @@
---
title: "Fix If-Check the result that a function was executed several times"
merge_request: 20640
author: Max Dicker
type: fixed

View file

@ -200,6 +200,15 @@ describe('Board list component', () => {
});
});
it('does not load issues if already loading', () => {
component.list.nextPage = spyOn(component.list, 'nextPage').and.returnValue(new Promise(() => {}));
component.onScroll();
component.onScroll();
expect(component.list.nextPage).toHaveBeenCalledTimes(1);
});
it('shows loading more spinner', (done) => {
component.showCount = true;
component.list.loadingMore = true;