mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Handle more override edge animate
This commit is contained in:
parent
c063b92cc9
commit
e2e5101005
@ -94,10 +94,10 @@ export const addVertex = function (
|
|||||||
const edge = edges.find((e) => e.id === id);
|
const edge = edges.find((e) => e.id === id);
|
||||||
if (edge) {
|
if (edge) {
|
||||||
const edgeDoc = doc as EdgeMetaData;
|
const edgeDoc = doc as EdgeMetaData;
|
||||||
if (edgeDoc?.animate) {
|
if (edgeDoc?.animate !== undefined) {
|
||||||
edge.animate = edgeDoc.animate;
|
edge.animate = edgeDoc.animate;
|
||||||
}
|
}
|
||||||
if (edgeDoc?.animation) {
|
if (edgeDoc?.animation !== undefined) {
|
||||||
edge.animation = edgeDoc.animation;
|
edge.animation = edgeDoc.animation;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -378,6 +378,28 @@ describe('when parsing directions', function () {
|
|||||||
expect(data4Layout.edges[5].id).toEqual('L_A1_D1_0');
|
expect(data4Layout.edges[5].id).toEqual('L_A1_D1_0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle overriding edge animate again', function () {
|
||||||
|
const res = flow.parser.parse(`flowchart TD
|
||||||
|
A e1@--> B
|
||||||
|
C e2@--> D
|
||||||
|
E e3@--> F
|
||||||
|
e1@{ animate: true }
|
||||||
|
e2@{ animate: false }
|
||||||
|
e3@{ animate: true }
|
||||||
|
e3@{ animate: false }
|
||||||
|
`);
|
||||||
|
|
||||||
|
const data4Layout = flow.parser.yy.getData();
|
||||||
|
expect(data4Layout.nodes.length).toBe(6);
|
||||||
|
expect(data4Layout.edges.length).toBe(3);
|
||||||
|
expect(data4Layout.edges[0].id).toEqual('e1');
|
||||||
|
expect(data4Layout.edges[0].animate).toEqual(true);
|
||||||
|
expect(data4Layout.edges[1].id).toEqual('e2');
|
||||||
|
expect(data4Layout.edges[1].animate).toEqual(false);
|
||||||
|
expect(data4Layout.edges[2].id).toEqual('e3');
|
||||||
|
expect(data4Layout.edges[2].animate).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
it.skip('should be possible to use @ syntax to add labels with trail spaces', function () {
|
it.skip('should be possible to use @ syntax to add labels with trail spaces', function () {
|
||||||
const res = flow.parser.parse(
|
const res = flow.parser.parse(
|
||||||
`flowchart TB
|
`flowchart TB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user