diff --git a/wcomponents-theme/src/main/js/wc/ui/popup.mjs b/wcomponents-theme/src/main/js/wc/ui/popup.mjs
index 74938e416..d5780f387 100755
--- a/wcomponents-theme/src/main/js/wc/ui/popup.mjs
+++ b/wcomponents-theme/src/main/js/wc/ui/popup.mjs
@@ -84,13 +84,8 @@ function _open(infoArr) {
name = uid();
}
}
- const specs = infoArr[SPECS_INDEX];
- // NOTE: new issue found in IE8 after an update in March 2014!! window.open(url, name, null) no longer has the same effect as window.open(url, name);
- if (specs) {
- window.open(infoArr[URL_INDEX], name, specs);
- } else {
- window.open(infoArr[URL_INDEX], name);
- }
+ const specs = infoArr[SPECS_INDEX] || "";
+ window.open(infoArr[URL_INDEX], name, specs);
}
/**
diff --git a/wcomponents-theme/src/test/spec/wc.ui.popup.test.mjs b/wcomponents-theme/src/test/spec/wc.ui.popup.test.mjs
index 37e173cb3..7ccff33f5 100755
--- a/wcomponents-theme/src/test/spec/wc.ui.popup.test.mjs
+++ b/wcomponents-theme/src/test/spec/wc.ui.popup.test.mjs
@@ -1,6 +1,6 @@
import "wc/ui/popup.mjs";
-import {beforeEach} from "node:test";
import domTesting from "@testing-library/dom";
+import popup from "wc/ui/popup.mjs";
/*
* Unit tests for wc/ui/modalShim
@@ -23,11 +23,12 @@ describe("wc/ui/popup", () => {
it("test onload popup with whitespace only target", function(done) {
const html = ``;
- testHolder.innerHTML = html;;
+ testHolder.innerHTML = html;
+
spyOn(window, "open").and.callFake((url, target, specs) => {
expect(url).toBe(URL);
expect(target.length).toBeGreaterThan(1);
- expect(specs).toBeUndefined();
+ expect(specs).toBeFalsy();
done();
});
});
@@ -35,6 +36,7 @@ describe("wc/ui/popup", () => {
it("test onload popup with top", function(done) {
const html = ``;
testHolder.innerHTML = html;
+ // @ts-ignore
spyOn(window, "open").and.callFake((url, target, specs) => {
expect(url).toBe(URL);
expect(target).toBeTruthy();
@@ -46,6 +48,7 @@ describe("wc/ui/popup", () => {
it("test onload popup with toolbar and target name", function(done) {
const html = ``;
testHolder.innerHTML = html;
+ // @ts-ignore
spyOn(window, "open").and.callFake((url, target, specs) => {
expect(url).toBe(URL);
expect(target).withContext("target should be stripped of whitespace").toEqual("ABC");
@@ -57,6 +60,7 @@ describe("wc/ui/popup", () => {
it("test onload popup with features, ignores resizable and scrollbars", function(done) {
const html = ``;
testHolder.innerHTML = html;
+ // @ts-ignore
spyOn(window, "open").and.callFake((url, target, specs) => {
expect(url).toBe(URL);
expect(target).toBeTruthy();
@@ -65,23 +69,25 @@ describe("wc/ui/popup", () => {
});
});
- // it("test popup button click", function(done) {
- // const html = ``;
- // testHolder.innerHTML = html;
- // const button = domTesting.getByTestId(testHolder, popperId);
- // const event = new MouseEvent("click", {
- // bubbles: true,
- // cancelable: true,
- // view: window
- // });
- // button.dispatchEvent(event);
- // spyOn(window, "open").and.callFake((url, target, specs) => {
- // expect(url).toBe(URL);
- // expect(target).toBeTruthy();
- // checkSpecs(specs);
- // done();
- // });
- // });
+ it("test popup button click", function(done) {
+ const specString = "height=300px,width=280px";
+ const html = ``;
+ testHolder.innerHTML = html;
+ const button = domTesting.getByTestId(testHolder, popperId);
+ const event = new MouseEvent("click", {
+ bubbles: true,
+ cancelable: true,
+ view: window
+ });
+ // @ts-ignore
+ spyOn(window, "open").and.callFake((url, target, specs) => {
+ expect(url).toEqual(URL);
+ expect(specs).toEqual(specString);
+ done();
+ });
+ expect(popup.isOneOfMe(button)).withContext("The test button is not correct").toBeTruthy();
+ button.dispatchEvent(event);
+ });
function checkSpecs(specs, overrides={}) {
const defaults = {