Fixed standalone distribution

This commit is contained in:
Steve Gravrock
2025-10-18 12:31:20 -07:00
parent f4b9c889b9
commit d66d0d9d2e
5 changed files with 19 additions and 13 deletions
+3 -1
View File
@@ -48,7 +48,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
const htmlReporter = new jasmine.HtmlReporterV2({ const htmlReporter = new jasmine.HtmlReporterV2({
env, env,
urls, urls,
container: document.body getContainer() {
return document.body;
}
}); });
/** /**
+5 -5
View File
@@ -963,7 +963,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
*/ */
class HtmlReporterV2 { class HtmlReporterV2 {
#env; #env;
#container; #getContainer;
#queryString; #queryString;
#urlBuilder; #urlBuilder;
#filterSpecs; #filterSpecs;
@@ -981,7 +981,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
constructor(options) { constructor(options) {
this.#env = options.env; this.#env = options.env;
this.#container = options.container; this.#getContainer = options.getContainer;
this.#queryString = this.#queryString =
options.queryString || options.queryString ||
new j$.QueryString({ new j$.QueryString({
@@ -1025,7 +1025,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
this.#alerts.rootEl, this.#alerts.rootEl,
this.#failures.rootEl this.#failures.rootEl
); );
this.#container.appendChild(this.#htmlReporterMain); this.#getContainer().appendChild(this.#htmlReporterMain);
this.#failures.show(); this.#failures.show();
} }
@@ -1114,7 +1114,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
} }
#find(selector) { #find(selector) {
return this.#container.querySelector( return this.#getContainer().querySelector(
'.jasmine_html-reporter ' + selector '.jasmine_html-reporter ' + selector
); );
} }
@@ -1123,7 +1123,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
const oldReporter = this.#find(''); const oldReporter = this.#find('');
if (oldReporter) { if (oldReporter) {
this.#container.removeChild(oldReporter); this.#getContainer().removeChild(oldReporter);
} }
} }
+3 -1
View File
@@ -14,7 +14,9 @@ describe('HtmlReporterV2', function() {
function setup(options = {}) { function setup(options = {}) {
return new jasmineUnderTest.HtmlReporterV2({ return new jasmineUnderTest.HtmlReporterV2({
env, env,
container, getContainer() {
return container;
},
urls: new jasmineUnderTest.HtmlReporterV2Urls(), urls: new jasmineUnderTest.HtmlReporterV2Urls(),
queryString: new jasmineUnderTest.QueryString({ queryString: new jasmineUnderTest.QueryString({
getWindowLocation() { getWindowLocation() {
+3 -1
View File
@@ -24,7 +24,9 @@
const htmlReporter = new jasmine.HtmlReporterV2({ const htmlReporter = new jasmine.HtmlReporterV2({
env, env,
urls, urls,
container: document.body getContainer() {
return document.body;
}
}); });
/** /**
+5 -5
View File
@@ -20,7 +20,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
*/ */
class HtmlReporterV2 { class HtmlReporterV2 {
#env; #env;
#container; #getContainer;
#queryString; #queryString;
#urlBuilder; #urlBuilder;
#filterSpecs; #filterSpecs;
@@ -38,7 +38,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
constructor(options) { constructor(options) {
this.#env = options.env; this.#env = options.env;
this.#container = options.container; this.#getContainer = options.getContainer;
this.#queryString = this.#queryString =
options.queryString || options.queryString ||
new j$.QueryString({ new j$.QueryString({
@@ -82,7 +82,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
this.#alerts.rootEl, this.#alerts.rootEl,
this.#failures.rootEl this.#failures.rootEl
); );
this.#container.appendChild(this.#htmlReporterMain); this.#getContainer().appendChild(this.#htmlReporterMain);
this.#failures.show(); this.#failures.show();
} }
@@ -171,7 +171,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
} }
#find(selector) { #find(selector) {
return this.#container.querySelector( return this.#getContainer().querySelector(
'.jasmine_html-reporter ' + selector '.jasmine_html-reporter ' + selector
); );
} }
@@ -180,7 +180,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
const oldReporter = this.#find(''); const oldReporter = this.#find('');
if (oldReporter) { if (oldReporter) {
this.#container.removeChild(oldReporter); this.#getContainer().removeChild(oldReporter);
} }
} }