Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed May 9, 2021
1 parent 43f6ae7 commit d3d0df5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
20 changes: 20 additions & 0 deletions cypress/integration/rendering/stateDiagram-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,26 @@ stateDiagram-v2
}
);
});
it('v2 should handle different rendering directions in composite states', () => {
imgSnapshotTest(
`
stateDiagram
direction LR
state A {
direction BT
a --> b
}
state C {
direction RL
c --> d
}
A --> C
`,
{
logLevel: 0, fontFamily: 'courier',
}
);
});
it('v2 handle transition from one state in a composite state to a composite state', () => {
imgSnapshotTest(
`
Expand Down
8 changes: 0 additions & 8 deletions src/diagrams/state/stateRenderer-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const setupNode = (g, parent, node, altFlag) => {
// group
if (!nodeDb[node.id].type && node.doc) {
log.info('Setting cluster for ', node.id, getDir(node));
console.info('Setting cluster for ', node.id, getDir(node));
nodeDb[node.id].type = 'group';
nodeDb[node.id].dir = getDir(node);
nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
Expand Down Expand Up @@ -220,9 +219,6 @@ const getDir = (nodes, defaultDir) => {
}
}
}
if(nodes.id==='A') {
console.log('nodes.id',nodes.id, dir)
}
return dir;
};
/**
Expand All @@ -232,7 +228,6 @@ const getDir = (nodes, defaultDir) => {
*/
export const draw = function(text, id) {
log.info('Drawing state diagram (v2)', id);
console.info('Drawing state diagram (v2)', id);
stateDb.clear();
nodeDb = {};
const parser = state.parser;
Expand All @@ -254,7 +249,6 @@ export const draw = function(text, id) {
log.info(stateDb.getRootDocV2());
stateDb.extract(stateDb.getRootDocV2());
log.info(stateDb.getRootDocV2());
console.info(stateDb.getRootDocV2());

// Create the input mermaid.graph
const g = new graphlib.Graph({
Expand All @@ -272,9 +266,7 @@ export const draw = function(text, id) {
return {};
});

console.info('Setup node')
setupNode(g, undefined, stateDb.getRootDocV2(), true);
console.info('Setup node done')

// Set up an SVG group so that we can translate the final graph.
const svg = select(`[id="${id}"]`);
Expand Down

0 comments on commit d3d0df5

Please sign in to comment.