mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 22:09:57 +02:00
Added E2E testing for spacing
This adds E2E testing for spacing and provides more appropriate comments for the changes made to `index.js`
This commit is contained in:
@@ -760,6 +760,28 @@ A ~~~ B
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('3258: Should render subgraphs with main graph nodeSpacing and rankSpacing', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`---
|
||||||
|
title: Subgraph nodeSpacing and rankSpacing example
|
||||||
|
---
|
||||||
|
flowchart LR
|
||||||
|
X --> Y
|
||||||
|
subgraph X
|
||||||
|
direction LR
|
||||||
|
A
|
||||||
|
C
|
||||||
|
end
|
||||||
|
subgraph Y
|
||||||
|
direction LR
|
||||||
|
B
|
||||||
|
D
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ flowchart: { nodeSpacing: 1, rankSpacing: 1 } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('Markdown strings flowchart (#4220)', () => {
|
describe('Markdown strings flowchart (#4220)', () => {
|
||||||
describe('html labels', () => {
|
describe('html labels', () => {
|
||||||
it('With styling and classes', () => {
|
it('With styling and classes', () => {
|
||||||
|
@@ -54,8 +54,8 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
|
|||||||
if (node && node.clusterNode) {
|
if (node && node.clusterNode) {
|
||||||
// const children = graph.children(v);
|
// const children = graph.children(v);
|
||||||
log.info('Cluster identified', v, node.width, graph.node(v));
|
log.info('Cluster identified', v, node.width, graph.node(v));
|
||||||
// node.graph.setGraph applies the graph configurations such as nodeSpacing to subgraphs as without this the default values would be used
|
// `node.graph.setGraph` applies the graph configurations such as nodeSpacing to subgraphs as without this the default values would be used
|
||||||
// We override the `rankdir` variable to allow for the subgraph's direction to override the graphs direction in the subgraph
|
// We override only the `ranksep` and `nodesep` configurations to allow for setting subgraph spacing while avoiding overriding other properties
|
||||||
const { ranksep, nodesep } = graph.graph();
|
const { ranksep, nodesep } = graph.graph();
|
||||||
node.graph.setGraph({
|
node.graph.setGraph({
|
||||||
...node.graph.graph(),
|
...node.graph.graph(),
|
||||||
|
Reference in New Issue
Block a user