Commit d4a2c9e6 authored by Regis's avatar Regis

prev next tests for pagination

parent f9db61fa
......@@ -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');
});
});
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