diff options
| author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-16 12:02:55 +0000 |
|---|---|---|
| committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-16 12:02:55 +0000 |
| commit | 51f037809e207b5a28d6c3f7945801a7a13739fe (patch) | |
| tree | 916405f5663fabdacb7cb990bd9eebd251334293 /spec/javascripts/lib/utils/common_utils_spec.js.es6 | |
| parent | ba53ee78fa5ff5be573ca9f9e2dda75e8089aa85 (diff) | |
| download | gitlab-ce-51f037809e207b5a28d6c3f7945801a7a13739fe.tar.gz | |
Create util to handle pagination transformation
Diffstat (limited to 'spec/javascripts/lib/utils/common_utils_spec.js.es6')
| -rw-r--r-- | spec/javascripts/lib/utils/common_utils_spec.js.es6 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js.es6 b/spec/javascripts/lib/utils/common_utils_spec.js.es6 index 006ede21093..f4d3e77e515 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js.es6 +++ b/spec/javascripts/lib/utils/common_utils_spec.js.es6 @@ -108,6 +108,30 @@ require('~/lib/utils/common_utils'); }); }); + describe('gl.utils.parseIntPagination', () => { + it('should parse to integers all string values and return pagination object', () => { + const pagination = { + 'X-PER-PAGE': 10, + 'X-PAGE': 2, + 'X-TOTAL': 30, + 'X-TOTAL-PAGES': 3, + 'X-NEXT-PAGE': 3, + 'X-PREV-PAGE': 1, + }; + + const expectedPagination = { + perPage: 10, + page: 2, + total: 30, + totalPages: 3, + nextPage: 3, + previousPage: 1, + }; + + expect(gl.utils.parseIntPagination(pagination)).toEqual(expectedPagination); + }); + }); + describe('gl.utils.isMetaClick', () => { it('should identify meta click on Windows/Linux', () => { const e = { |
