diff options
author | Regis <boudinot.regis@yahoo.com> | 2016-12-13 10:52:07 -0700 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2016-12-13 10:52:07 -0700 |
commit | d4a2c9e6fbfae18b305fb8dee9face7de88c2e6d (patch) | |
tree | a7c384265120bad5f59ec49c2b657f1863db33ce /spec | |
parent | f9db61fa7c596816367345de948fc6c92a1eabbe (diff) | |
download | gitlab-ce-d4a2c9e6fbfae18b305fb8dee9face7de88c2e6d.tar.gz |
prev next tests for pagination
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_pagination/pagination_spec.js.es6 | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/spec/javascripts/vue_pagination/pagination_spec.js.es6 b/spec/javascripts/vue_pagination/pagination_spec.js.es6 index 4a0b60b2e75..9c1fdd339c9 100644 --- a/spec/javascripts/vue_pagination/pagination_spec.js.es6 +++ b/spec/javascripts/vue_pagination/pagination_spec.js.es6 @@ -37,7 +37,7 @@ describe('Pagination component', () => { expect(changeChanges.two).toEqual('all'); }); - it('should change page to 2 and previous should go cak to 1', () => { + it('should go to the previous page', () => { fixture.set('<div class="test-pagination-container"></div>'); component = new window.gl.VueGlPagination({ @@ -45,23 +45,37 @@ describe('Pagination component', () => { propsData: { pageInfo: { totalPages: 10, - nextPage: 2, - previousPage: '', + nextPage: 3, + previousPage: 1, }, change, }, }); - expect(component.$el.classList).toContain('gl-pagination'); - - component.changepage({ target: { innerText: '2' } }); + component.changepage({ target: { innerText: 'Prev' } }); - expect(changeChanges.one).toEqual(2); + expect(changeChanges.one).toEqual(1); expect(changeChanges.two).toEqual('all'); + }); - component.changepage({ target: { innerText: 'Prev' } }); + it('should go to the next page', () => { + fixture.set('<div class="test-pagination-container"></div>'); - expect(changeChanges.one).toEqual(1); + component = new window.gl.VueGlPagination({ + el: document.querySelector('.test-pagination-container'), + propsData: { + pageInfo: { + totalPages: 10, + nextPage: 5, + previousPage: 3, + }, + change, + }, + }); + + component.changepage({ target: { innerText: 'Next' } }); + + expect(changeChanges.one).toEqual(5); expect(changeChanges.two).toEqual('all'); }); }); |