From d66d0d9d2e78432efe5e7784b0d40f800396c472 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 18 Oct 2025 12:31:20 -0700 Subject: [PATCH] Fixed standalone distribution --- lib/jasmine-core/boot1.js | 4 +++- lib/jasmine-core/jasmine-html.js | 10 +++++----- spec/html/HtmlReporterV2Spec.js | 4 +++- src/boot/boot1.js | 4 +++- src/html/HtmlReporterV2.js | 10 +++++----- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/jasmine-core/boot1.js b/lib/jasmine-core/boot1.js index 4ad598ab..d9ea7105 100644 --- a/lib/jasmine-core/boot1.js +++ b/lib/jasmine-core/boot1.js @@ -48,7 +48,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. const htmlReporter = new jasmine.HtmlReporterV2({ env, urls, - container: document.body + getContainer() { + return document.body; + } }); /** diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index 3b4c2ccd..8216ae9c 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -963,7 +963,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { */ class HtmlReporterV2 { #env; - #container; + #getContainer; #queryString; #urlBuilder; #filterSpecs; @@ -981,7 +981,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { constructor(options) { this.#env = options.env; - this.#container = options.container; + this.#getContainer = options.getContainer; this.#queryString = options.queryString || new j$.QueryString({ @@ -1025,7 +1025,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { this.#alerts.rootEl, this.#failures.rootEl ); - this.#container.appendChild(this.#htmlReporterMain); + this.#getContainer().appendChild(this.#htmlReporterMain); this.#failures.show(); } @@ -1114,7 +1114,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { } #find(selector) { - return this.#container.querySelector( + return this.#getContainer().querySelector( '.jasmine_html-reporter ' + selector ); } @@ -1123,7 +1123,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { const oldReporter = this.#find(''); if (oldReporter) { - this.#container.removeChild(oldReporter); + this.#getContainer().removeChild(oldReporter); } } diff --git a/spec/html/HtmlReporterV2Spec.js b/spec/html/HtmlReporterV2Spec.js index d5e0b70f..e1a1c6f3 100644 --- a/spec/html/HtmlReporterV2Spec.js +++ b/spec/html/HtmlReporterV2Spec.js @@ -14,7 +14,9 @@ describe('HtmlReporterV2', function() { function setup(options = {}) { return new jasmineUnderTest.HtmlReporterV2({ env, - container, + getContainer() { + return container; + }, urls: new jasmineUnderTest.HtmlReporterV2Urls(), queryString: new jasmineUnderTest.QueryString({ getWindowLocation() { diff --git a/src/boot/boot1.js b/src/boot/boot1.js index d2556668..8de247e9 100644 --- a/src/boot/boot1.js +++ b/src/boot/boot1.js @@ -24,7 +24,9 @@ const htmlReporter = new jasmine.HtmlReporterV2({ env, urls, - container: document.body + getContainer() { + return document.body; + } }); /** diff --git a/src/html/HtmlReporterV2.js b/src/html/HtmlReporterV2.js index d63e084b..7660ef0f 100644 --- a/src/html/HtmlReporterV2.js +++ b/src/html/HtmlReporterV2.js @@ -20,7 +20,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { */ class HtmlReporterV2 { #env; - #container; + #getContainer; #queryString; #urlBuilder; #filterSpecs; @@ -38,7 +38,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { constructor(options) { this.#env = options.env; - this.#container = options.container; + this.#getContainer = options.getContainer; this.#queryString = options.queryString || new j$.QueryString({ @@ -82,7 +82,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { this.#alerts.rootEl, this.#failures.rootEl ); - this.#container.appendChild(this.#htmlReporterMain); + this.#getContainer().appendChild(this.#htmlReporterMain); this.#failures.show(); } @@ -171,7 +171,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { } #find(selector) { - return this.#container.querySelector( + return this.#getContainer().querySelector( '.jasmine_html-reporter ' + selector ); } @@ -180,7 +180,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) { const oldReporter = this.#find(''); if (oldReporter) { - this.#container.removeChild(oldReporter); + this.#getContainer().removeChild(oldReporter); } }