Skip to content
Snippets Groups Projects
Commit c922b846 authored by Phil Hughes's avatar Phil Hughes
Browse files

Only increase the page number for boards when we need to

Closes #30902
parent d7a52716
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,7 +58,9 @@ class List {
 
nextPage () {
if (this.issuesSize > this.issues.length) {
this.page += 1;
if (this.issues.length / 20 >= 1) {
this.page += 1;
}
 
return this.getIssues(false);
}
Loading
Loading
@@ -145,10 +147,7 @@ class List {
}
 
updateIssueLabel(issue, listFrom, moveBeforeIid, moveAfterIid) {
gl.boardService.moveIssue(issue.id, listFrom.id, this.id, moveBeforeIid, moveAfterIid)
.then(() => {
listFrom.getIssues(false);
});
gl.boardService.moveIssue(issue.id, listFrom.id, this.id, moveBeforeIid, moveAfterIid);
}
 
findIssue (id) {
Loading
Loading
Loading
Loading
@@ -107,4 +107,44 @@ describe('List model', () => {
expect(gl.boardService.moveIssue)
.toHaveBeenCalledWith(issue.id, list.id, listDup.id, undefined, undefined);
});
describe('page number', () => {
beforeEach(() => {
spyOn(list, 'getIssues');
});
it('increase page number if current issue count is more than the page size', () => {
for (let i = 0; i < 30; i+=1) {
list.issues.push(new ListIssue({
title: 'Testing',
iid: _.random(10000) + i,
confidential: false,
labels: [list.label]
}));
}
list.issuesSize = 50;
expect(list.issues.length).toBe(30);
list.nextPage();
expect(list.page).toBe(2);
expect(list.getIssues).toHaveBeenCalled();
});
it('does not increase page number if issue count is less than the page size', () => {
list.issues.push(new ListIssue({
title: 'Testing',
iid: _.random(10000),
confidential: false,
labels: [list.label]
}));
list.issuesSize = 2;
list.nextPage();
expect(list.page).toBe(1);
expect(list.getIssues).toHaveBeenCalled();
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment