Commit c4d2db1f authored by Dicker Max's avatar Dicker Max Committed by Fatih Acet

Fix if-check

parent 7a0e2426
...@@ -203,7 +203,7 @@ export default { ...@@ -203,7 +203,7 @@ export default {
this.showIssueForm = !this.showIssueForm; this.showIssueForm = !this.showIssueForm;
}, },
onScroll() { onScroll() {
if (!this.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) { if (!this.list.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
this.loadNextPage(); this.loadNextPage();
} }
}, },
......
---
title: "Fix If-Check the result that a function was executed several times"
merge_request: 20640
author: Max Dicker
type: fixed
...@@ -200,6 +200,15 @@ describe('Board list component', () => { ...@@ -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) => { it('shows loading more spinner', (done) => {
component.showCount = true; component.showCount = true;
component.list.loadingMore = true; component.list.loadingMore = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment