Skip to content

Commit

Permalink
feat(pintora-diagrams): [activityDiagram] Add support for parallel pr…
Browse files Browse the repository at this point in the history
…ocessing (fork)

- fix condition labels
  • Loading branch information
hikerpig committed Dec 30, 2021
1 parent 6bd23b6 commit 3ab6f2e
Show file tree
Hide file tree
Showing 14 changed files with 501 additions and 28 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-extra-semi': 'off',
'prefer-spread': 0,
'prettier/prettier': 'warn',
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ Check the online [documentation and demo](http://pintorajs.vercel.app/docs/intro
- [x] Pintora node.js cli
- [x] PlantUML style Component diagram
- [x] Theme config
- [ ] PlantUML style activity diagram, or Mermaid's flowchart
- [x] PlantUML style activity diagram, or Mermaid's flowchart
- [ ] PlantUML style deploy diagram
- [ ] Load diagram implementation and canvas renderer only when needed
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,80 @@ activityDiagram
],
})
})

it('can parse fork sentence', () => {
const example = stripStartEmptyLines(`
activityDiagram
fork
:action 1;
forkagain
:action 2;
endfork
`)
parse(example)
const ir = db.getDiagramIR()
// console.log('ir', JSON.stringify(ir, null, 2))
expect(ir.steps).toMatchObject([
{
type: 'fork',
value: {
id: '1',
branches: [
{
type: 'forkBranch',
value: {
id: '2',
children: [
{
type: 'action',
value: {
actionType: 'normal',
message: 'action 1',
id: '3',
},
parentId: '2',
},
],
},
parentId: '1',
},
{
type: 'forkBranch',
value: {
id: '4',
children: [
{
type: 'action',
value: {
actionType: 'normal',
message: 'action 2',
id: '5',
},
parentId: '4',
},
],
},
parentId: '1',
},
],
},
},
])
})

it('can parse fork with end merge', () => {
const example = stripStartEmptyLines(`
activityDiagram
fork
:action 1;
:action 11;
forkagain
:action 2;
endmerge
`)
parse(example)
const ir = db.getDiagramIR()
// console.log('ir', JSON.stringify(ir, null, 2))
expect(ir.steps[0].value.shouldMerge).toBeTruthy()
})
})
Loading

0 comments on commit 3ab6f2e

Please sign in to comment.