diff options
-rw-r--r-- | spec/javascripts/vue_pagination/pagination_spec.js.es6 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/javascripts/vue_pagination/pagination_spec.js.es6 b/spec/javascripts/vue_pagination/pagination_spec.js.es6 index eeed95a42c0..3a57f69676f 100644 --- a/spec/javascripts/vue_pagination/pagination_spec.js.es6 +++ b/spec/javascripts/vue_pagination/pagination_spec.js.es6 @@ -142,3 +142,25 @@ describe('Pagination component', () => { expect(changeChanges.two).toEqual('all'); }); }); + +describe('paramHelper', () => { + it('can parse url parameters correctly', () => { + window.history.pushState({}, null, '?scope=all&p=2'); + + const scope = gl.getParameterByName('scope'); + const p = gl.getParameterByName('p'); + + expect(scope).toEqual('all'); + expect(p).toEqual('2'); + }); + + it('returns null if param not in url', () => { + window.history.pushState({}, null, '?p=2'); + + const scope = gl.getParameterByName('scope'); + const p = gl.getParameterByName('p'); + + expect(scope).toEqual(null); + expect(p).toEqual('2'); + }); +}); |