diff --git a/src/client/src/components/ChatView.test.ts b/src/client/src/components/ChatView.test.ts index 6c846a7..87091e8 100644 --- a/src/client/src/components/ChatView.test.ts +++ b/src/client/src/components/ChatView.test.ts @@ -141,6 +141,24 @@ describe("ChatView session-warning dismiss wiring", () => { expect(onDismissWarning).toHaveBeenCalledExactlyOnceWith("anthropicExtraUsage"); }); + // Escape hatch: this verifies the minimise chevron's Lit callback wiring in + // the node test environment, anchored to its stable semantic class marker. + // The chevron is wired to the unified onToggleWarnings (toggle ≡ collapse in + // the expanded state), so this also proves the single visibility mutation. + it("invokes onToggleWarnings from the visible warning area", () => { + const view = withStatus(new ChatView(), warningStatus([ + { severity: "warning", message: "subscription auth is active" }, + ])); + const onToggleWarnings = vi.fn(); + view.onToggleWarnings = onToggleWarnings; + + const rendered = renderWarnings(view); + if (rendered === null) throw new Error("expected a warnings banner"); + templateEventHandlerAfterMarker(rendered, "session-warnings-collapse")(new Event("click")); + + expect(onToggleWarnings).toHaveBeenCalledOnce(); + }); + it("removes the warning area while presentation is collapsed or there are no warnings", () => { const view = withStatus(new ChatView(), warningStatus([ { severity: "warning", message: "subscription auth is active" }, diff --git a/src/client/src/components/ChatView.ts b/src/client/src/components/ChatView.ts index b8c7390..b17e8ee 100644 --- a/src/client/src/components/ChatView.ts +++ b/src/client/src/components/ChatView.ts @@ -199,6 +199,7 @@ export class ChatView extends LitElement { @property({ attribute: false }) onDismissNotification?: (notificationId: string) => void; @property({ attribute: false }) onDismissAllNotifications?: () => void; @property({ type: Boolean }) warningsVisible = true; + @property({ attribute: false }) onToggleWarnings?: () => void; @property({ attribute: false }) onLoadMore?: () => void; @query(".chat") private chat?: HTMLDivElement; @query("dialog.image-zoom") private imageZoomDialog?: HTMLDialogElement; @@ -252,6 +253,9 @@ export class ChatView extends LitElement { private readonly handleClearServerQueue = (): void => { this.onClearServerQueue?.(); }; + private readonly handleToggleWarnings = (): void => { + this.onToggleWarnings?.(); + }; override connectedCallback(): void { super.connectedCallback(); @@ -511,6 +515,22 @@ export class ChatView extends LitElement { if (!this.warningsVisible || rows.length === 0) return null; return html`