From ee88ecc61417816f5ebd84edcbb40eb62e4954c9 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Mon, 28 Jun 2021 12:39:36 -0700 Subject: [PATCH] Revert "add url pathName in toQueryString function - fixes (https://github.com/jasmine/jasmine/issues/1906 ) + comment + test" Reverted because it breaks the option checkboxes in the HTML reporter, both in the standalone distribution and in jasmine-browser-runner. Reopens #1906. This reverts commit 1e4f0d1545c4e0a582391821d1ffa52f544bdfb5. --- lib/jasmine-core/jasmine-html.js | 5 +---- spec/html/QueryStringSpec.js | 15 --------------- src/html/QueryString.js | 5 +---- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index 6320c9dc..ebe94049 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -810,10 +810,7 @@ jasmineRequire.QueryString = function() { encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]) ); } - // include getWindowLocation() to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - return ( - (options.getWindowLocation().pathname || '') + '?' + qStrPairs.join('&') - ); + return '?' + qStrPairs.join('&'); } function queryStringToParamMap() { diff --git a/spec/html/QueryStringSpec.js b/spec/html/QueryStringSpec.js index b9303be2..de2f5721 100644 --- a/spec/html/QueryStringSpec.js +++ b/spec/html/QueryStringSpec.js @@ -48,21 +48,6 @@ describe('QueryString', function() { expect(result).toMatch(/foo=bar/); expect(result).toMatch(/baz=quux/); }); - - it('includes url pathname with the query string including the given key/value pair', function() { - var windowLocation = { - pathname: 'debug.html', - search: '?foo=bar' - }, - queryString = new jasmineUnderTest.QueryString({ - getWindowLocation: function() { - return windowLocation; - } - }); - - var result = queryString.fullStringWithNewParam('baz', 'quux'); - expect(result).toBe('debug.html?foo=bar&baz=quux'); - }); }); describe('#getParam', function() { diff --git a/src/html/QueryString.js b/src/html/QueryString.js index 736a691c..c4ce950e 100644 --- a/src/html/QueryString.js +++ b/src/html/QueryString.js @@ -26,10 +26,7 @@ jasmineRequire.QueryString = function() { encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]) ); } - // include getWindowLocation() to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - return ( - (options.getWindowLocation().pathname || '') + '?' + qStrPairs.join('&') - ); + return '?' + qStrPairs.join('&'); } function queryStringToParamMap() {