added changeset and unit test

This commit is contained in:
khalil
2025-04-05 20:46:16 +01:00
parent 99797632ab
commit aa6cb86899
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
'mermaid': major
---
Added support for the click directive in stateDiagram syntax

View File

@@ -442,5 +442,22 @@ describe('state diagram V2, ', function () {
const currentDirection = stateDb.getDirection();
expect(currentDirection).toEqual('LR');
});
it('should parse and store clickable link with tooltip using the click directive', () => {
const diagram = `
stateDiagram-v2
[*] --> StateA
click StateA "https://example.com" "Go to Example"
`;
parser.parse(diagram);
const links = stateDb.getLinks();
expect(links.has('StateA')).toBe(true);
const linkInfo = links.get('StateA');
expect(linkInfo.url).toBe('https://example.com');
expect(linkInfo.tooltip).toBe('Go to Example');
});
});
});