mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-07 16:19:38 +02:00
Initial implementation for Issue#2249.
Includes changes to sequence diagram code to enable popup menus and individualized styling of actors Includes unit and e2e tests. Includes updates to the md file for sequencediagrams.
This commit is contained in:
@@ -898,6 +898,49 @@ end`;
|
||||
expect(messages[3].message).toBe('');
|
||||
expect(messages[4].message).toBe('I am good thanks!');
|
||||
});
|
||||
|
||||
it('it should handle links', function () {
|
||||
const str = `
|
||||
sequenceDiagram
|
||||
participant a as Alice
|
||||
participant b as Bob
|
||||
participant c as Charlie
|
||||
links a: { "Repo": "https://repo.contoso.com/", "Dashboard": "https://dashboard.contoso.com/" }
|
||||
links b: { "Dashboard": "https://dashboard.contoso.com/" }
|
||||
links a: { "On-Call": "https://oncall.contoso.com/?svc=alice" }
|
||||
`;
|
||||
console.log(str);
|
||||
|
||||
mermaidAPI.parse(str);
|
||||
const actors = parser.yy.getActors();
|
||||
expect(actors.a.links["Repo"]).toBe("https://repo.contoso.com/");
|
||||
expect(actors.b.links["Repo"]).toBe(undefined);
|
||||
expect(actors.a.links["Dashboard"]).toBe("https://dashboard.contoso.com/");
|
||||
expect(actors.b.links["Dashboard"]).toBe("https://dashboard.contoso.com/");
|
||||
expect(actors.a.links["On-Call"]).toBe("https://oncall.contoso.com/?svc=alice");
|
||||
expect(actors.c.links["Dashboard"]).toBe(undefined);
|
||||
});
|
||||
|
||||
it('it should handle properties', function () {
|
||||
const str = `
|
||||
sequenceDiagram
|
||||
participant a as Alice
|
||||
participant b as Bob
|
||||
participant c as Charlie
|
||||
properties a: {"class": "internal-service-actor", "icon": "@clock"}
|
||||
properties b: {"class": "external-service-actor", "icon": "@computer"}
|
||||
`;
|
||||
console.log(str);
|
||||
|
||||
mermaidAPI.parse(str);
|
||||
const actors = parser.yy.getActors();
|
||||
expect(actors.a.properties["class"]).toBe("internal-service-actor");
|
||||
expect(actors.b.properties["class"]).toBe("external-service-actor");
|
||||
expect(actors.a.properties["icon"]).toBe("@clock");
|
||||
expect(actors.b.properties["icon"]).toBe("@computer");
|
||||
expect(actors.c.properties["class"]).toBe(undefined);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when checking the bounds in a sequenceDiagram', function() {
|
||||
|
Reference in New Issue
Block a user