Restore classes on edges for elk

This commit is contained in:
Yoav Sternberg
2023-06-02 22:10:39 +03:00
parent 1b40f552b2
commit da1beb36bf
2 changed files with 15 additions and 1 deletions

View File

@@ -684,6 +684,20 @@ A --> B
{ titleTopMargin: 0 } { titleTopMargin: 0 }
); );
}); });
it('elk: should include classes on the edges', () => {
renderGraph(
`flowchart-elk TD
A --> B --> C --> D
`,
{}
);
cy.get('svg').should((svg) => {
const edges = svg.querySelectorAll('.edges > path');
edges.forEach((edge) => {
expect(edge).to.have.class('flowchart-link');
});
});
});
describe('Markdown strings flowchart-elk (#4220)', () => { describe('Markdown strings flowchart-elk (#4220)', () => {
describe('html labels', () => { describe('html labels', () => {
it('With styling and classes', () => { it('With styling and classes', () => {

View File

@@ -717,7 +717,7 @@ const insertEdge = function (edgesEl, edge, edgeData, diagObj, parentLookupDb) {
const edgePath = edgesEl const edgePath = edgesEl
.insert('path') .insert('path')
.attr('d', curve(points)) .attr('d', curve(points))
.attr('class', 'path') .attr('class', 'path ' + edgeData.classes)
.attr('fill', 'none'); .attr('fill', 'none');
const edgeG = edgesEl.insert('g').attr('class', 'edgeLabel'); const edgeG = edgesEl.insert('g').attr('class', 'edgeLabel');
const edgeWithLabel = select(edgeG.node().appendChild(edge.labelEl)); const edgeWithLabel = select(edgeG.node().appendChild(edge.labelEl));