summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegis <boudinot.regis@yahoo.com>2016-12-16 16:31:28 -0700
committerRegis <boudinot.regis@yahoo.com>2016-12-16 16:31:28 -0700
commit552953c9f22a3bd2e13deba71cefb921144296eb (patch)
treec05d9c1cfe1af967adeabb8f43f6dbc2896d3f6b
parente98cdf4b2070c27da76cfa4ba3d5e2022ff08b19 (diff)
downloadgitlab-ce-552953c9f22a3bd2e13deba71cefb921144296eb.tar.gz
add paramHelper tests
-rw-r--r--spec/javascripts/vue_pagination/pagination_spec.js.es622
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');
+ });
+});