mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Bug1061-CannotMarkMembersAsProtectedInClassDiagram
Using # to indicate protected status of a member or method causing parser error when not used inside class declaration brackets {}. Removed '#' from `LABEL` regex
This commit is contained in:
parent
3469cfca2f
commit
68c2ea38c9
@ -19,6 +19,9 @@ describe('Class diagram', () => {
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
Class01 : -int privateChimp
|
||||
Class01 : +int publicGorilla
|
||||
Class01 : #int protectedMarmoset
|
||||
Class08 <--> C2: Cool label
|
||||
class Class10 {
|
||||
<<service>>
|
||||
|
6
dist/index.html
vendored
6
dist/index.html
vendored
@ -408,9 +408,9 @@ Class09 "0" --* "1..n" C3
|
||||
Class09 --|> Class07
|
||||
Class07 : equals()
|
||||
Class07 : Object[] elementData
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
Class01 : #size()
|
||||
Class01 : -int chimp
|
||||
Class01 : +int gorilla
|
||||
Class08 <--> C2: Cool label
|
||||
class Class10 {
|
||||
<<service>>
|
||||
|
@ -40,6 +40,21 @@ describe('class diagram, ', function() {
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle visibility for methods and members', function() {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
'class TestClass\n' +
|
||||
'TestClass : -int privateMember\n' +
|
||||
'TestClass : +int publicMember\n' +
|
||||
'TestClass : #int protectedMember\n' +
|
||||
'TestClass : -privateMethod()\n' +
|
||||
'TestClass : +publicMethod()\n' +
|
||||
'TestClass : #protectedMethod()\n' +
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle class definitions', function() {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
|
@ -36,7 +36,7 @@
|
||||
\s*o return 'AGGREGATION';
|
||||
\-\- return 'LINE';
|
||||
\.\. return 'DOTTED_LINE';
|
||||
":"[^#\n;]+ return 'LABEL';
|
||||
":"[^\n;]+ return 'LABEL';
|
||||
\- return 'MINUS';
|
||||
"." return 'DOT';
|
||||
\+ return 'PLUS';
|
||||
|
Loading…
x
Reference in New Issue
Block a user