summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorRegis <boudinot.regis@yahoo.com>2016-12-13 10:58:59 -0700
committerRegis <boudinot.regis@yahoo.com>2016-12-13 10:58:59 -0700
commitd46af1d9b263916063200f5fd2cafa18df11c37b (patch)
tree350347c0b81bb976618d38bad53609896036455b /spec/javascripts
parentd4a2c9e6fbfae18b305fb8dee9face7de88c2e6d (diff)
downloadgitlab-ce-d46af1d9b263916063200f5fd2cafa18df11c37b.tar.gz
main scope of pagination covered
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vue_pagination/pagination_spec.js.es663
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/javascripts/vue_pagination/pagination_spec.js.es6 b/spec/javascripts/vue_pagination/pagination_spec.js.es6
index 9c1fdd339c9..b7f41a875d7 100644
--- a/spec/javascripts/vue_pagination/pagination_spec.js.es6
+++ b/spec/javascripts/vue_pagination/pagination_spec.js.es6
@@ -78,4 +78,67 @@ describe('Pagination component', () => {
expect(changeChanges.one).toEqual(5);
expect(changeChanges.two).toEqual('all');
});
+
+ it('should go to the last page', () => {
+ fixture.set('<div class="test-pagination-container"></div>');
+
+ component = new window.gl.VueGlPagination({
+ el: document.querySelector('.test-pagination-container'),
+ propsData: {
+ pageInfo: {
+ totalPages: 10,
+ nextPage: 5,
+ previousPage: 3,
+ },
+ change,
+ },
+ });
+
+ component.changepage({ target: { innerText: 'Last >>' } });
+
+ expect(changeChanges.one).toEqual(10);
+ expect(changeChanges.two).toEqual('all');
+ });
+
+ it('should go to the first page', () => {
+ fixture.set('<div class="test-pagination-container"></div>');
+
+ component = new window.gl.VueGlPagination({
+ el: document.querySelector('.test-pagination-container'),
+ propsData: {
+ pageInfo: {
+ totalPages: 10,
+ nextPage: 5,
+ previousPage: 3,
+ },
+ change,
+ },
+ });
+
+ component.changepage({ target: { innerText: '<< First' } });
+
+ expect(changeChanges.one).toEqual(1);
+ expect(changeChanges.two).toEqual('all');
+ });
+
+ it('should do nothing', () => {
+ fixture.set('<div class="test-pagination-container"></div>');
+
+ component = new window.gl.VueGlPagination({
+ el: document.querySelector('.test-pagination-container'),
+ propsData: {
+ pageInfo: {
+ totalPages: 10,
+ nextPage: 2,
+ previousPage: '',
+ },
+ change,
+ },
+ });
+
+ component.changepage({ target: { innerText: '...' } });
+
+ expect(changeChanges.one).toEqual(1);
+ expect(changeChanges.two).toEqual('all');
+ });
});