-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #6056 allows all characters except [ and ]
Add example in demos/architecture.html Adds some rudimentary unit tests for architecture parser
- Loading branch information
Showing
5 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@mermaid-js/parser': patch | ||
--- | ||
|
||
fix: Allow most characters in architecture node titles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { Architecture } from '../src/language/index.js'; | ||
import { expectNoErrorsOrAlternatives, architectureParse as parse } from './test-util.js'; | ||
|
||
describe('architecture', () => { | ||
it.each([ | ||
`architecture-beta`, | ||
` architecture-beta `, | ||
`\tarchitecture-beta\t`, | ||
` | ||
\tarchitecture-beta | ||
`, | ||
` | ||
\tarchitecture-beta | ||
`, | ||
])('should handle regular architecture', (context: string) => { | ||
const result = parse(context); | ||
expectNoErrorsOrAlternatives(result); | ||
expect(result.value.$type).toBe(Architecture); | ||
}); | ||
|
||
it.each([ | ||
`architecture-beta | ||
group foo(cloud)`, | ||
`architecture-beta | ||
service foo(server) | ||
`, | ||
])('should handle group and service', (context: string) => { | ||
const result = parse(context); | ||
expectNoErrorsOrAlternatives(result); | ||
expect(result.value.$type).toBe(Architecture); | ||
}); | ||
|
||
it.each([ | ||
`architecture-beta | ||
service foo(cloud)[Foo] | ||
service bar(cloud)[Foo-Bar] | ||
service bar2(cloud)[Foo/Bar] | ||
service bar3(cloud)[Foo:Bar] | ||
service bar4(cloud)["Foo:Bar"] | ||
`, | ||
])('should handle labels with non-alpha characters', (context: string) => { | ||
const result = parse(context); | ||
expectNoErrorsOrAlternatives(result); | ||
expect(result.value.$type).toBe(Architecture); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters