diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-12 13:04:00 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-12 14:05:44 +0000 |
commit | c2fe699ac801fd2440cc4b57083a60a334cffa06 (patch) | |
tree | 5f340cf6f2d120255c909e10fba2c0627949363f /spec/javascripts | |
parent | 27d7ec70b1efcaac73095e6ea3894b0eb9ba8473 (diff) | |
download | gitlab-ce-c2fe699ac801fd2440cc4b57083a60a334cffa06.tar.gz |
Add pagination tests for environments table
Remove fdescribe statement
Fix conflict
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/environments/environment_spec.js.es6 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/javascripts/environments/environment_spec.js.es6 b/spec/javascripts/environments/environment_spec.js.es6 index 657d8d2ab02..edd0cad32d0 100644 --- a/spec/javascripts/environments/environment_spec.js.es6 +++ b/spec/javascripts/environments/environment_spec.js.es6 @@ -99,6 +99,48 @@ describe('Environment', () => { done(); }, 0); }); + + it('should update url when no search params are present', (done) => { + spyOn(gl.utils, 'visitUrl'); + setTimeout(() => { + component.$el.querySelector('.gl-pagination li:nth-child(5) a').click(); + expect(gl.utils.visitUrl).toHaveBeenCalledWith('?page=2'); + done(); + }, 0); + }); + + it('should update url when page is already present', (done) => { + spyOn(gl.utils, 'visitUrl'); + window.history.pushState({}, null, '?page=1'); + + setTimeout(() => { + component.$el.querySelector('.gl-pagination li:nth-child(5) a').click(); + expect(gl.utils.visitUrl).toHaveBeenCalledWith('?page=2'); + done(); + }, 0); + }); + + it('should update url when page and scope are already present', (done) => { + spyOn(gl.utils, 'visitUrl'); + window.history.pushState({}, null, '?scope=all&page=1'); + + setTimeout(() => { + component.$el.querySelector('.gl-pagination li:nth-child(5) a').click(); + expect(gl.utils.visitUrl).toHaveBeenCalledWith('?scope=all&page=2'); + done(); + }, 0); + }); + + it('should update url when page and scope are already present and page is first param', (done) => { + spyOn(gl.utils, 'visitUrl'); + window.history.pushState({}, null, '?page=1&scope=all'); + + setTimeout(() => { + component.$el.querySelector('.gl-pagination li:nth-child(5) a').click(); + expect(gl.utils.visitUrl).toHaveBeenCalledWith('?page=2&scope=all'); + done(); + }, 0); + }); }); }); }); |