diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-13 16:33:19 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-13 16:33:19 +0100 |
commit | c922b846fee750dae855b1811d83e27f95b6dcec (patch) | |
tree | 03cb3cbbc39800de8da2787e583cd06a5f9cdbbc /spec/javascripts | |
parent | d7a527163b64fa38e46fc6195fef2f5d93e47d07 (diff) | |
download | gitlab-ce-c922b846fee750dae855b1811d83e27f95b6dcec.tar.gz |
Only increase the page number for boards when we need to
Closes #30902
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/boards/list_spec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js index a9d4c6ef76f..7c88a362fd2 100644 --- a/spec/javascripts/boards/list_spec.js +++ b/spec/javascripts/boards/list_spec.js @@ -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(); + }); + }); }); |