summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotheus Kampik <timotheus.kampik@gmail.com>2018-07-28 21:12:05 +0200
committerTimotheus Kampik <timotheus.kampik@gmail.com>2018-07-28 21:12:05 +0200
commitafe46ef74ca43080010c356711193b7dde0df69c (patch)
treef987c10c41ec8dea09e01ac108fc3d3c66e7cab6
parentfcd0b78afa01c2bbf6672b463ad78736f9f3681b (diff)
downloadsphinx-git-afe46ef74ca43080010c356711193b7dde0df69c.tar.gz
#5186 add tests for `getQueryParameters()`
and fix test description of `urldecode()`
-rw-r--r--tests/js/doctools.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/js/doctools.js b/tests/js/doctools.js
index 32fd68c10..8533f7148 100644
--- a/tests/js/doctools.js
+++ b/tests/js/doctools.js
@@ -2,7 +2,7 @@ var DOCUMENTATION_OPTIONS = {};
describe('urldecode', function() {
- it('should fail', function() {
+ it('should correctly decode URLs and replace `+`s with a spaces', function() {
var test_encoded_string =
'%D1%88%D0%B5%D0%BB%D0%BB%D1%8B+%D1%88%D0%B5%D0%BB%D0%BB%D1%8B';
var test_decoded_string = 'шеллы шеллы';
@@ -10,3 +10,23 @@ describe('urldecode', function() {
});
});
+
+describe('getQueryParameters', function() {
+ var paramString = '?q=test+this&check_keywords=yes&area=default';
+ var queryParamObject = {
+ area: ['default'],
+ check_keywords: ['yes'],
+ q: ['test this']
+ };
+
+ it('should correctly create query parameter object from string', function() {
+ expect(jQuery.getQueryParameters(paramString)).toEqual(queryParamObject);
+ });
+
+ it('should correctly create query param object from URL params', function() {
+ history.pushState({}, '_', window.location + paramString);
+ expect(jQuery.getQueryParameters()).toEqual(queryParamObject);
+ });
+
+});
+