Commit f9db61fa authored by Regis's avatar Regis

add more tests for pagination

parent 7d2ca647
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
return `has-tooltip ci-status-icon-${this.stage.status.label}`; return `has-tooltip ci-status-icon-${this.stage.status.label}`;
}, },
svg() { svg() {
// debugger
return this.svgs[this.match(this.stage.status.icon)]; return this.svgs[this.match(this.stage.status.icon)];
}, },
}, },
......
...@@ -14,7 +14,7 @@ describe('Pagination component', () => { ...@@ -14,7 +14,7 @@ describe('Pagination component', () => {
changeChanges.two = two; changeChanges.two = two;
}; };
it('should render', () => { it('should render and start at page 1', () => {
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({
...@@ -36,4 +36,32 @@ describe('Pagination component', () => { ...@@ -36,4 +36,32 @@ describe('Pagination component', () => {
expect(changeChanges.one).toEqual(1); expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual('all'); expect(changeChanges.two).toEqual('all');
}); });
it('should change page to 2 and previous should go cak to 1', () => {
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,
},
});
expect(component.$el.classList).toContain('gl-pagination');
component.changepage({ target: { innerText: '2' } });
expect(changeChanges.one).toEqual(2);
expect(changeChanges.two).toEqual('all');
component.changepage({ target: { innerText: 'Prev' } });
expect(changeChanges.one).toEqual(1);
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