mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
Fix subgraph issue
This commit is contained in:
@@ -22,6 +22,17 @@ describe('when parsing ', function () {
|
||||
expect(edges[0].text).toBe('')
|
||||
})
|
||||
|
||||
it('should handle subgraph with tab indentation', function () {
|
||||
const res = flow.parser.parse('graph TB\nsubgraph One\n\ta1-->a2\nend')
|
||||
const subgraphs = flow.parser.yy.getSubGraphs()
|
||||
expect(subgraphs.length).toBe(1)
|
||||
const subgraph = subgraphs[0]
|
||||
expect(subgraph.nodes.length).toBe(2)
|
||||
expect(subgraph.nodes[0]).toBe('a1')
|
||||
expect(subgraph.nodes[1]).toBe('a2')
|
||||
expect(subgraph.title).toBe('One')
|
||||
})
|
||||
|
||||
it('should handle angle bracket ' > ' as direction LR', function () {
|
||||
const res = flow.parser.parse('graph >;A-->B;')
|
||||
|
||||
|
Reference in New Issue
Block a user