summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/vue_pipelines_index/stage.js.es61
-rw-r--r--spec/javascripts/vue_pagination/pagination_spec.js.es630
2 files changed, 29 insertions, 2 deletions
diff --git a/app/assets/javascripts/vue_pipelines_index/stage.js.es6 b/app/assets/javascripts/vue_pipelines_index/stage.js.es6
index 9a2aa5af2b4..7fcf575b17f 100644
--- a/app/assets/javascripts/vue_pipelines_index/stage.js.es6
+++ b/app/assets/javascripts/vue_pipelines_index/stage.js.es6
@@ -12,7 +12,6 @@
return `has-tooltip ci-status-icon-${this.stage.status.label}`;
},
svg() {
- // debugger
return this.svgs[this.match(this.stage.status.icon)];
},
},
diff --git a/spec/javascripts/vue_pagination/pagination_spec.js.es6 b/spec/javascripts/vue_pagination/pagination_spec.js.es6
index 201295ec97e..4a0b60b2e75 100644
--- a/spec/javascripts/vue_pagination/pagination_spec.js.es6
+++ b/spec/javascripts/vue_pagination/pagination_spec.js.es6
@@ -14,7 +14,7 @@ describe('Pagination component', () => {
changeChanges.two = two;
};
- it('should render', () => {
+ it('should render and start at page 1', () => {
fixture.set('<div class="test-pagination-container"></div>');
component = new window.gl.VueGlPagination({
@@ -36,4 +36,32 @@ describe('Pagination component', () => {
expect(changeChanges.one).toEqual(1);
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');
+ });
});