diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js
index c1878cb5..2e776517 100644
--- a/lib/jasmine-core/jasmine-html.js
+++ b/lib/jasmine-core/jasmine-html.js
@@ -970,38 +970,32 @@ jasmineRequire.ResultsNode = function() {
};
jasmineRequire.QueryString = function() {
- function QueryString(options) {
- this.navigateWithNewParam = function(key, value) {
- options.getWindowLocation().search = this.fullStringWithNewParam(
+ class QueryString {
+ #getWindowLocation;
+
+ constructor(options) {
+ this.#getWindowLocation = options.getWindowLocation;
+ }
+
+ navigateWithNewParam(key, value) {
+ this.#getWindowLocation().search = this.fullStringWithNewParam(
key,
value
);
- };
-
- this.fullStringWithNewParam = function(key, value) {
- const paramMap = queryStringToParamMap();
- paramMap[key] = value;
- return toQueryString(paramMap);
- };
-
- this.getParam = function(key) {
- return queryStringToParamMap()[key];
- };
-
- return this;
-
- function toQueryString(paramMap) {
- const qStrPairs = [];
- for (const prop in paramMap) {
- qStrPairs.push(
- encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
- );
- }
- return '?' + qStrPairs.join('&');
}
- function queryStringToParamMap() {
- const paramStr = options.getWindowLocation().search.substring(1);
+ fullStringWithNewParam(key, value) {
+ const paramMap = this.#queryStringToParamMap();
+ paramMap[key] = value;
+ return toQueryString(paramMap);
+ }
+
+ getParam(key) {
+ return this.#queryStringToParamMap()[key];
+ }
+
+ #queryStringToParamMap() {
+ const paramStr = this.#getWindowLocation().search.substring(1);
let params = [];
const paramMap = {};
@@ -1021,6 +1015,16 @@ jasmineRequire.QueryString = function() {
}
}
+ function toQueryString(paramMap) {
+ const qStrPairs = [];
+ for (const prop in paramMap) {
+ qStrPairs.push(
+ encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
+ );
+ }
+ return '?' + qStrPairs.join('&');
+ }
+
return QueryString;
};
diff --git a/src/html/QueryString.js b/src/html/QueryString.js
index 8a1857a3..8ed5bc62 100644
--- a/src/html/QueryString.js
+++ b/src/html/QueryString.js
@@ -1,36 +1,30 @@
jasmineRequire.QueryString = function() {
- function QueryString(options) {
- this.navigateWithNewParam = function(key, value) {
- options.getWindowLocation().search = this.fullStringWithNewParam(
+ class QueryString {
+ #getWindowLocation;
+
+ constructor(options) {
+ this.#getWindowLocation = options.getWindowLocation;
+ }
+
+ navigateWithNewParam(key, value) {
+ this.#getWindowLocation().search = this.fullStringWithNewParam(
key,
value
);
- };
-
- this.fullStringWithNewParam = function(key, value) {
- const paramMap = queryStringToParamMap();
- paramMap[key] = value;
- return toQueryString(paramMap);
- };
-
- this.getParam = function(key) {
- return queryStringToParamMap()[key];
- };
-
- return this;
-
- function toQueryString(paramMap) {
- const qStrPairs = [];
- for (const prop in paramMap) {
- qStrPairs.push(
- encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
- );
- }
- return '?' + qStrPairs.join('&');
}
- function queryStringToParamMap() {
- const paramStr = options.getWindowLocation().search.substring(1);
+ fullStringWithNewParam(key, value) {
+ const paramMap = this.#queryStringToParamMap();
+ paramMap[key] = value;
+ return toQueryString(paramMap);
+ }
+
+ getParam(key) {
+ return this.#queryStringToParamMap()[key];
+ }
+
+ #queryStringToParamMap() {
+ const paramStr = this.#getWindowLocation().search.substring(1);
let params = [];
const paramMap = {};
@@ -50,5 +44,15 @@ jasmineRequire.QueryString = function() {
}
}
+ function toQueryString(paramMap) {
+ const qStrPairs = [];
+ for (const prop in paramMap) {
+ qStrPairs.push(
+ encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
+ );
+ }
+ return '?' + qStrPairs.join('&');
+ }
+
return QueryString;
};