fix: ensure edge labels respect htmlLabels=false

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-09-09 19:08:00 +05:30
parent 3840451fda
commit 810071c46b
5 changed files with 72 additions and 16 deletions

View File

@@ -122,6 +122,46 @@ describe('Flowchart v2', () => {
expect(svg).to.not.have.attr('style');
});
});
it('renders only pure SVG labels (no <foreignObject>) when flowchart.htmlLabels=false', () => {
renderGraph(
`---
config:
flowchart:
htmlLabels: false
---
flowchart LR
subgraph \`**One**\`
a["\`**The cat**
in the hat\`"] -- "\`**edge label**\`" --> b{{"\`**The dog** in the hog\`"}}
end
subgraph \`**Two**\`
c["\`**The cat**
in the hat\`"] -- "\`**Bold edge label**\`" --> d["\`The dog in the hog\`"]
end
`
);
cy.get('svg').find('foreignObject').should('not.exist');
});
it('renders only pure SVG labels (no <foreignObject>) when global htmlLabels=false', () => {
renderGraph(
`---
config:
htmlLabels: false
---
flowchart LR
subgraph \`**One**\`
a["\`**The cat**
in the hat\`"] -- "\`**edge label**\`" --> b{{"\`**The dog** in the hog\`"}}
end
subgraph \`**Two**\`
c["\`**The cat**
in the hat\`"] -- "\`**Bold edge label**\`" --> d["\`The dog in the hog\`"]
end
`
);
cy.get('svg').find('foreignObject').should('not.exist');
});
it('V2 - 16: Render Stadium shape', () => {
imgSnapshotTest(