Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,19 @@ export function MermaidPreviewPanel({
: styles.exportWorking
}
role={exportStatus.type === "error" ? "alert" : "status"}
aria-live={exportStatus.type === "error" ? undefined : "polite"}
>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{exportStatus.message}
<span>{exportStatus.message}</span>
{exportStatus.type !== "working" && (
<button
type="button"
onClick={() => setExportStatus({ type: "idle" })}
aria-label="Close export status message"
className={styles.statusCloseButton}
>
<span className="codicon codicon-close" aria-hidden="true" />
</button>
)}
Comment on lines +328 to +337

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add tests for the new dismiss path.

This introduces user-facing state transitions (show close button for success/error, hide for working, click resets to idle). The provided test context covers status/alert roles, but not this new close interaction. A focused test here would prevent regressions in exactly the thing this PR adds.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/extension/src/webview/components/MermaidPreviewPanel.tsx` around
lines 328 - 337, Add a unit test for MermaidPreviewPanel that verifies the new
dismiss path: render the panel with exportStatus set to a non-"working" state
(e.g., {type: "success"} and {type: "error"}) and assert the close button
(element with class statusCloseButton or aria-label "Close export status
message") is visible for those states but not when exportStatus.type ===
"working"; simulate a click on that close button and assert that the
setExportStatus mock is called with { type: "idle" } (use the existing test
harness/mock for setExportStatus to locate the prop passed into
MermaidPreviewPanel and reuse the alert/role-based selectors already present in
tests).

</div>
)}
{preview.status !== "ok" ? (
Expand Down
Loading