diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-03-31 13:22:31 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-04-03 12:40:31 +0300 |
commit | c4d4f4d8577ec3d8e728bc56b3811db33094dd61 (patch) | |
tree | 5cb8991810821eac21e5785a2bf8f8a115315e4b /spec/javascripts | |
parent | 20b54b133c1714e6a2b0afbbf4c1770991e8e344 (diff) |
Clean history after every test that changes history
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/environments/environment_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/lib/utils/common_utils_spec.js | 8 | ||||
-rw-r--r-- | spec/javascripts/vue_shared/components/table_pagination_spec.js | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/spec/javascripts/environments/environment_spec.js b/spec/javascripts/environments/environment_spec.js index 9601575577e..9bcf617fcd8 100644 --- a/spec/javascripts/environments/environment_spec.js +++ b/spec/javascripts/environments/environment_spec.js @@ -91,6 +91,10 @@ describe('Environment', () => { }); describe('pagination', () => { + afterEach(() => { + window.history.pushState({}, null, ''); + }); + it('should render pagination', (done) => { setTimeout(() => { expect( diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js index d6dcdbf1d12..0fa4c51560b 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js +++ b/spec/javascripts/lib/utils/common_utils_spec.js @@ -46,6 +46,10 @@ require('~/lib/utils/common_utils'); spyOn(window.document, 'getElementById').and.callThrough(); }); + afterEach(() => { + window.history.pushState({}, null, ''); + }); + function expectGetElementIdToHaveBeenCalledWith(elementId) { expect(window.document.getElementById).toHaveBeenCalledWith(elementId); } @@ -80,6 +84,10 @@ require('~/lib/utils/common_utils'); window.history.pushState({}, null, '?scope=all&p=2'); }); + afterEach(() => { + window.history.pushState({}, null, ''); + }); + it('should return valid parameter', () => { const value = gl.utils.getParameterByName('scope'); expect(value).toBe('all'); diff --git a/spec/javascripts/vue_shared/components/table_pagination_spec.js b/spec/javascripts/vue_shared/components/table_pagination_spec.js index d1640ffed99..96038718191 100644 --- a/spec/javascripts/vue_shared/components/table_pagination_spec.js +++ b/spec/javascripts/vue_shared/components/table_pagination_spec.js @@ -124,6 +124,10 @@ describe('Pagination component', () => { }); describe('paramHelper', () => { + afterEach(() => { + window.history.pushState({}, null, ''); + }); + it('can parse url parameters correctly', () => { window.history.pushState({}, null, '?scope=all&p=2'); |