+ `;
+ document.documentElement.replaceChild(replacementBody, document.body);
+
+ initializeAttendeesUi();
+ document.getElementById("open-attendee-notification-modal")?.click();
+
+ expect(document.getElementById("attendee-notification-form")?.getAttribute("hx-post")).to.equal(
+ "/dashboard/group/notifications/event-99",
+ );
+ expect(document.getElementById("attendee-notification-modal")?.classList.contains("hidden")).to.equal(
+ false,
+ );
+ });
+
it("opens the refund review modal with attendee payment details", () => {
const originalHtmx = window.htmx;
const processCalls = [];
@@ -136,10 +165,7 @@ describe("dashboard group attendees", () => {
expect(rejectButton.getAttribute("hx-put")).to.equal(
"/dashboard/group/events/event-1/attendees/user-1/refund/reject",
);
- expect(processCalls).to.deep.equal([
- "attendee-refund-approve",
- "attendee-refund-reject",
- ]);
+ expect(processCalls).to.deep.equal(["attendee-refund-approve", "attendee-refund-reject"]);
window.htmx = originalHtmx;
});
@@ -344,12 +370,8 @@ describe("dashboard group attendees", () => {
document.querySelector("[data-refund-review-trigger]")?.click();
expect(modal.classList.contains("hidden")).to.equal(false);
- expect(document.getElementById("attendee-refund-name")?.textContent).to.equal(
- "Swapped Attendee",
- );
- expect(document.getElementById("attendee-refund-ticket")?.textContent).to.equal(
- "Swapped Ticket",
- );
+ expect(document.getElementById("attendee-refund-name")?.textContent).to.equal("Swapped Attendee");
+ expect(document.getElementById("attendee-refund-ticket")?.textContent).to.equal("Swapped Ticket");
expect(document.getElementById("attendee-refund-amount")?.textContent).to.equal("EUR 25.00");
expect(approveButton.getAttribute("hx-put")).to.equal(
"/dashboard/group/events/event-2/attendees/user-2/refund/approve",
@@ -463,10 +485,7 @@ describe("dashboard group attendees", () => {
document.querySelector("[data-refund-review-trigger]")?.click();
- expect(processCalls).to.deep.equal([
- "attendee-refund-approve",
- "attendee-refund-reject",
- ]);
+ expect(processCalls).to.deep.equal(["attendee-refund-approve", "attendee-refund-reject"]);
window.htmx = originalHtmx;
});
diff --git a/tests/unit/dashboard/group/members.test.js b/tests/unit/dashboard/group/members.test.js
index ff6953484..2c0c88c99 100644
--- a/tests/unit/dashboard/group/members.test.js
+++ b/tests/unit/dashboard/group/members.test.js
@@ -1,7 +1,8 @@
import { expect } from "@open-wc/testing";
+import "/static/js/dashboard/group/members.js";
import { useDashboardTestEnv } from "/tests/unit/test-utils/env.js";
-import { dispatchHtmxAfterRequest } from "/tests/unit/test-utils/htmx.js";
+import { dispatchHtmxAfterRequest, dispatchHtmxLoad } from "/tests/unit/test-utils/htmx.js";
describe("dashboard group members", () => {
const env = useDashboardTestEnv({
@@ -22,7 +23,7 @@ describe("dashboard group members", () => {
`;
- await import(`/static/js/dashboard/group/members.js?test=${Date.now()}`);
+ dispatchHtmxLoad();
dispatchHtmxAfterRequest(document.getElementById("notification-form"), {
status: 204,
@@ -33,4 +34,23 @@ describe("dashboard group members", () => {
icon: "success",
});
});
+
+ it("opens the notification modal after the dashboard body is swapped", () => {
+ const replacementBody = document.createElement("body");
+ replacementBody.innerHTML = `
+
+
+
+
+
+
+ `;
+
+ document.documentElement.replaceChild(replacementBody, document.body);
+
+ dispatchHtmxLoad();
+ document.getElementById("open-notification-modal")?.click();
+
+ expect(document.getElementById("notification-modal")?.classList.contains("hidden")).to.equal(false);
+ });
});
diff --git a/tests/unit/dashboard/group/sponsors.test.js b/tests/unit/dashboard/group/sponsors.test.js
new file mode 100644
index 000000000..2c0fc78eb
--- /dev/null
+++ b/tests/unit/dashboard/group/sponsors.test.js
@@ -0,0 +1,51 @@
+import { expect } from "@open-wc/testing";
+
+import "/static/js/dashboard/group/sponsors.js";
+import { waitForMicrotask } from "/tests/unit/test-utils/async.js";
+import { useDashboardTestEnv } from "/tests/unit/test-utils/env.js";
+import { dispatchHtmxLoad } from "/tests/unit/test-utils/htmx.js";
+import { mockFetch } from "/tests/unit/test-utils/network.js";
+
+describe("dashboard group sponsors", () => {
+ useDashboardTestEnv({
+ path: "/dashboard/group/sponsors",
+ withScroll: true,
+ withSwal: true,
+ });
+
+ let fetchMock;
+
+ beforeEach(() => {
+ fetchMock = mockFetch();
+ });
+
+ afterEach(() => {
+ fetchMock.restore();
+ });
+
+ it("updates sponsor featured toggles after the dashboard body is swapped", async () => {
+ const replacementBody = document.createElement("body");
+ replacementBody.innerHTML = `
+
+
+ `;
+ document.documentElement.replaceChild(replacementBody, document.body);
+
+ dispatchHtmxLoad();
+ const checkbox = document.querySelector(".sponsor-featured-toggle");
+ checkbox.checked = true;
+ checkbox.dispatchEvent(new Event("change", { bubbles: true }));
+
+ await waitForMicrotask();
+
+ expect(fetchMock.calls).to.have.length(1);
+ expect(fetchMock.calls[0][0]).to.equal("/dashboard/group/sponsors/sponsor-7/featured");
+ expect(checkbox.dataset.currentChecked).to.equal("true");
+ });
+});
diff --git a/tests/unit/dashboard/user/session-proposals.test.js b/tests/unit/dashboard/user/session-proposals.test.js
index c502ddfd6..d439789ce 100644
--- a/tests/unit/dashboard/user/session-proposals.test.js
+++ b/tests/unit/dashboard/user/session-proposals.test.js
@@ -50,6 +50,20 @@ describe("dashboard user session proposals", () => {
expect(modalComponent.dataset.sessionProposalReady).to.equal("true");
});
+ it("opens the create modal after the dashboard body is swapped", () => {
+ const replacementBody = document.createElement("body");
+ replacementBody.innerHTML = `
+
+ `;
+ replacementBody.append(modalComponent);
+ document.documentElement.replaceChild(replacementBody, document.body);
+
+ initializeSessionProposalsUi();
+ document.getElementById("open-session-proposal-modal")?.click();
+
+ expect(modalComponent.openCreateCalls).to.equal(1);
+ });
+
it("opens edit and view modals with normalized proposal payloads", () => {
const proposalPayload = JSON.stringify({
session_proposal_id: 12,
@@ -132,7 +146,10 @@ describe("dashboard user session proposals", () => {
text: "Are you sure you want to delete this session proposal?",
confirmButtonText: "Delete",
});
- expect(env.current.htmx.triggerCalls[0]).to.deep.equal(["#delete-session-proposal-proposal-7", "confirmed"]);
+ expect(env.current.htmx.triggerCalls[0]).to.deep.equal([
+ "#delete-session-proposal-proposal-7",
+ "confirmed",
+ ]);
const rejectButton = document.querySelector('[data-action="reject-co-speaker-invitation"]');
rejectButton.click();
diff --git a/tests/unit/dashboard/user/submissions.test.js b/tests/unit/dashboard/user/submissions.test.js
index 108b84b79..2b2fbf153 100644
--- a/tests/unit/dashboard/user/submissions.test.js
+++ b/tests/unit/dashboard/user/submissions.test.js
@@ -50,6 +50,33 @@ describe("dashboard user submissions", () => {
expect(document.body.style.overflow).to.equal("");
});
+ it("opens the action required modal after the dashboard body is swapped", () => {
+ const replacementBody = document.createElement("body");
+ replacementBody.innerHTML = `
+
+
+
+
+
+
+ `;
+ document.documentElement.replaceChild(replacementBody, document.body);
+
+ initializeSubmissionsUi();
+ document.querySelector('[data-action="open-action-required-modal"]')?.click();
+
+ expect(document.getElementById("action-required-modal-message")?.textContent).to.equal(
+ "Please update the bio before resubmitting.",
+ );
+ expect(document.getElementById("action-required-modal")?.classList.contains("hidden")).to.equal(false);
+ });
+
it("opens a confirmation dialog for withdraw actions and handles request errors", async () => {
document.body.innerHTML = `