Adding support for title and accessibilities

This commit is contained in:
Knut Sveidqvist
2025-05-15 10:44:46 +02:00
parent f970fc8bea
commit 41108358f6
5 changed files with 167 additions and 76 deletions

View File

@@ -287,4 +287,55 @@ classDef sales fill:#c3a66b,stroke:#333;
{}
);
});
it('12: should render a treemap with title', () => {
imgSnapshotTest(
`
treemap
title Treemap with Title
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it('13: should render a treemap with accessibility attributes', () => {
imgSnapshotTest(
`
treemap
accTitle: Accessible Treemap Title
accDescr: This is a description of the treemap for accessibility purposes
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it('14: should render a treemap with title and accessibility attributes', () => {
imgSnapshotTest(
`
treemap
title Treemap with Title and Accessibility
accTitle: Accessible Treemap Title
accDescr: This is a description of the treemap for accessibility purposes
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
});

View File

@@ -64,7 +64,7 @@
color: grey;
}
.mermaid {
border: 0px solid red;
border: 1px solid red;
}
.mermaid2 {
display: none;
@@ -130,7 +130,7 @@
</head>
<body>
<pre id="diagram4" class="mermaid2">
<pre id="diagram4" class="mermaid">
treemap
"Section 1"
"Leaf 1.1": 12
@@ -160,19 +160,15 @@ treemap
</pre
>
<pre id="diagram4" class="mermaid2">
treemap
"Root"
"Branch 1"
"Leaf 1.1": 12
"Branch 1.2"
"Leaf 1.2.1": 110
"Leaf 1.2.2": 12
"Leaf 1.2.3": 13
"Branch 2"
"Leaf 2.1": 20
"Leaf 2.2": 25
"Leaf 2.3": 12
<pre id="diagram4" class="mermaid">
treemap
title Treemap with Title
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
</pre>
<pre id="diagram4" class="mermaid2">
flowchart LR
@@ -507,7 +503,7 @@ kanban
alert('It worked');
}
await mermaid.initialize({
theme: 'base',
theme: 'forest',
// theme: 'default',
// theme: 'forest',
// handDrawnSeed: 12,