Merge branch 'select-spec' of https://github.com/jlpstolwijk/jasmine into main

* Merges #1907 from @jlpstolwijk
* Fixes #1906
* Fixes spec filtering in karma-jasmine-html-reporter
This commit is contained in:
Steve Gravrock
2021-06-14 17:57:16 -07:00
3 changed files with 23 additions and 2 deletions

View File

@@ -810,7 +810,10 @@ jasmineRequire.QueryString = function() {
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
);
}
return '?' + qStrPairs.join('&');
// 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('&')
);
}
function queryStringToParamMap() {

View File

@@ -48,6 +48,21 @@ 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() {

View File

@@ -26,7 +26,10 @@ jasmineRequire.QueryString = function() {
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
);
}
return '?' + qStrPairs.join('&');
// 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('&')
);
}
function queryStringToParamMap() {