Behaviour SwRS-MDOKFSTUDIO-DIAG-015
Invalid Mermaid shows one message with the parser reason
When Mermaid cannot draw a diagram, the page SHALL show at the top of the diagram element exactly one message "Unable to render Mermaid diagram. Its source remains available below." followed by one collapsed "Show the parser error" section holding the parser's reason as plain text, and set data-render-state to error.
Step 1 of path 2 in StRS-MDOKFSTUDIO-DIAG-001: from “A Mermaid fence holds invalid syntax” to “A parser message shows and the source stays available”.
Scenarios 4
The situations the tests check; open one to read it.
nominalSyntax error
Givena Mermaid diagram with invalid syntax
Whenthe page draws it
Thenthe diagram element starts with the message "Unable to render Mermaid diagram. Its source remains available below.", then a closed details element titled "Show the parser error" holding the reason, and data-render-state is error; the "Diagram source" disclosure still holds the source
boundaryReason with markup
Givena parser reason that contains HTML text such as an image tag with an onerror handler
Whenthe page shows the error
Thenthe reason is displayed as text, no element is created from it and the details element stays closed
boundaryTheme switches redraw the error
Givenan invalid Mermaid diagram
Whenthe theme changes through dark, white, cream and the original mode
Thenafter each change the diagram holds one error message and one details section
boundaryChanging reason
Givenan error shown for line 2 and a new error for line 3
Whenthe page shows the second error
Thenthe earlier error is replaced and the details section holds only the line 3 reason
Implemented in 1
Tested by 2
Known limits (4)
- The diagram text also stays inside the diagram element under the message, so the source shows once there and once in the disclosure.
- A failed Mermaid diagram posts no diagnostic to the status line or the Problems list because the drawing happens in the page.
- The message uses the theme error colour --studio-errorForeground with the fallback #f14c4c.
- The visual check sets the render state to pending before each theme change to force a redraw.
Replaces
SwRS-MDOKFSTUDIO-DIAG-016An invalid Mermaid diagram keeps exactly one error superseded superseded by SwRS-MDOKFSTUDIO-DIAG-015 Markdown file