mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-13 12:29:42 +02:00
1119 Support method return types
Small refactor to split out logic for determining method display text and style. Updated documentation Used regex to parse method statements in class diagrams to extract discrete elements to set display appropriately. Added tests and updated docs
This commit is contained in:
@@ -105,7 +105,7 @@ describe('class diagram, ', function () {
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle parsing of method statements grouped by brackets', function () {
|
||||
it('should handle parsing of method statements grouped by brackets', function () {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
'class Dummy_Class {\n' +
|
||||
@@ -121,6 +121,36 @@ describe('class diagram, ', function () {
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle return types on methods', function () {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
'Object <|-- ArrayList\n' +
|
||||
'Object : equals()\n' +
|
||||
'Object : -Object[] objects\n' +
|
||||
'Object : +getObjects() Object[]\n' +
|
||||
'ArrayList : Dummy elementData\n' +
|
||||
'ArrayList : getDummy() Dummy';
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle return types on methods grouped by brackets', function () {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
'class Dummy_Class {\n' +
|
||||
'string data\n' +
|
||||
'getDummy() Dummy\n' +
|
||||
'}\n' +
|
||||
'\n' +
|
||||
'class Flight {\n' +
|
||||
' int flightNumber\n' +
|
||||
' datetime departureTime\n' +
|
||||
' getDepartureTime() datetime\n' +
|
||||
'}';
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('should handle parsing of separators', function () {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
|
Reference in New Issue
Block a user