Files
mermaid-live-editor/tests/docMap.spec.ts
T
Sidharth VinodandClaude Opus 5.5 7cb51a1d4f feat: Link docs for the diagram types added in mermaid 11.6–12
Adds docs paths for agentflow, cynefin, eventmodeling, ishikawa, radar,
the four railroad variants, swimlane, treeView, usecase, venn and
wardley, taken from packages/mermaid/src/docs/syntax in the mermaid repo
and checked against the published pages (config anchors included).

A new test parses every @mermaid-js/examples sample and fails when a
detected diagram type has no docs entry, so the next new type is caught
on the dependency bump instead of silently linking to the docs home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 10:29:49 +05:30

51 lines
2.0 KiB
TypeScript

import { test } from './test';
test.describe('Editor docs tests', () => {
test.beforeEach(async ({ editPage }) => {
await editPage.toggleSampleDiagrams();
});
test('Test default loading', async ({ editPage }) => {
await editPage.checkDocURL(/mermaid\.js\.org\//);
});
test('Test to see if the correct URL loads when changing from one diagram to other', async ({
editPage
}) => {
await editPage.loadSampleDiagram('Flowchart');
await editPage.checkDocURL(/syntax\/flowchart\.html/);
await editPage.setEditorMode('Config');
await editPage.checkDocURL(/syntax\/flowchart\.html#configuration/);
await editPage.setEditorMode('Code');
await editPage.checkDocURL(/syntax\/flowchart\.html/);
await editPage.loadSampleDiagram('Sequence');
await editPage.checkDocURL(/syntax\/sequenceDiagram\.html/);
await editPage.setEditorMode('Config');
await editPage.checkDocURL(/syntax\/sequenceDiagram\.html#configuration/);
await editPage.setEditorMode('Code');
await editPage.checkDocURL(/syntax\/sequenceDiagram\.html/);
await editPage.loadSampleDiagram('Class');
await editPage.checkDocURL(/syntax\/classDiagram\.html/);
await editPage.setEditorMode('Config');
await editPage.checkDocURL(/syntax\/classDiagram\.html#configuration/);
await editPage.setEditorMode('Code');
await editPage.loadSampleDiagram('Radar');
await editPage.checkDocURL(/syntax\/radar\.html/);
await editPage.setEditorMode('Config');
await editPage.checkDocURL(/syntax\/radar\.html#configuration/);
await editPage.setEditorMode('Code');
});
test("Test to check URLs for a case where config URL doesn't exist", async ({ editPage }) => {
await editPage.loadSampleDiagram('State');
await editPage.checkDocURL(/syntax\/stateDiagram\.html/);
await editPage.setEditorMode('Config');
await editPage.checkDocURL(/syntax\/stateDiagram\.html/);
await editPage.setEditorMode('Code');
await editPage.checkDocURL(/syntax\/stateDiagram\.html/);
});
});