Revert "Move knowledge of query parameters out of boot1.js"

This reverts commit 6715f24fd0.
This commit is contained in:
Steve Gravrock
2025-10-05 09:54:25 -07:00
parent c590095662
commit 489b83c61b
7 changed files with 58 additions and 63 deletions

View File

@@ -14,12 +14,20 @@
(function() {
const env = jasmine.getEnv();
/**
* ## Runner Parameters
*
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
*/
const queryString = new jasmine.QueryString({
getWindowLocation: function() {
return window.location;
}
});
const filterSpecs = !!queryString.getParam('spec');
const config = {
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
stopSpecOnExpectationFailure: queryString.getParam(
@@ -61,7 +69,7 @@
return document.createTextNode.apply(document, arguments);
},
timer: new jasmine.Timer(),
queryString
filterSpecs: filterSpecs
});
/**
@@ -73,7 +81,12 @@
/**
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
*/
const specFilter = new jasmine.HtmlExactSpecFilter({ queryString });
const specFilter = new jasmine.HtmlExactSpecFilter({
filterString: function() {
return queryString.getParam('spec');
}
});
config.specFilter = function(spec) {
return specFilter.matches(spec);
};

View File

@@ -10,13 +10,16 @@ jasmineRequire.HtmlExactSpecFilter = function() {
/**
* Create a filter instance.
* @param options Object with a queryString property, which should be an
* instance of {@link QueryString}.
* @param options Object with a filterString method, which should
* return the value of the "spec" query string parameter set by
* {@link HtmlReporter}.
*/
constructor(options) {
this.#getFilterString = function() {
return options.queryString.getParam('spec');
};
if (typeof options?.filterString !== 'function') {
throw new Error('options.filterString must be a function');
}
this.#getFilterString = options.filterString;
}
/**

View File

@@ -64,14 +64,10 @@ jasmineRequire.HtmlReporter = function(j$) {
const getContainer = options.getContainer;
const createElement = options.createElement;
const createTextNode = options.createTextNode;
// TODO: in the next major release, replace navigateWithNewParam and
// addToExistingQueryString with direct usage of options.queryString
const navigateWithNewParam = options.navigateWithNewParam || function() {};
const addToExistingQueryString =
options.addToExistingQueryString || defaultQueryString;
const filterSpecs = options.queryString
? !!options.queryString.getParam('spec')
: options.filterSpecs; // For compatibility with pre-5.11 boot files
const filterSpecs = options.filterSpecs;
let htmlReporterMain;
let symbols;
const deprecationWarnings = [];