Commit d4a2c9e6 authored by Regis's avatar Regis

prev next tests for pagination

parent f9db61fa
...@@ -37,7 +37,7 @@ describe('Pagination component', () => { ...@@ -37,7 +37,7 @@ describe('Pagination component', () => {
expect(changeChanges.two).toEqual('all'); 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>'); fixture.set('<div class="test-pagination-container"></div>');
component = new window.gl.VueGlPagination({ component = new window.gl.VueGlPagination({
...@@ -45,23 +45,37 @@ describe('Pagination component', () => { ...@@ -45,23 +45,37 @@ describe('Pagination component', () => {
propsData: { propsData: {
pageInfo: { pageInfo: {
totalPages: 10, totalPages: 10,
nextPage: 2, nextPage: 3,
previousPage: '', previousPage: 1,
}, },
change, change,
}, },
}); });
expect(component.$el.classList).toContain('gl-pagination'); component.changepage({ target: { innerText: 'Prev' } });
component.changepage({ target: { innerText: '2' } });
expect(changeChanges.one).toEqual(2); expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual('all'); 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'); expect(changeChanges.two).toEqual('all');
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment