Skip to content

Commit

Permalink
Revert "add url pathName in toQueryString function - fixes (#1906 ) +…
Browse files Browse the repository at this point in the history
… 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 1e4f0d1.
  • Loading branch information
sgravrock committed Jun 28, 2021
1 parent ec03827 commit ee88ecc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
5 changes: 1 addition & 4 deletions lib/jasmine-core/jasmine-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
15 changes: 0 additions & 15 deletions spec/html/QueryStringSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 1 addition & 4 deletions src/html/QueryString.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ee88ecc

Please sign in to comment.