mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
apply suggesitons
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
class Zebra{
|
class Zebra{
|
||||||
+bool is_wild
|
+bool is_wild
|
||||||
+run()
|
+run(List~T~, List~OT~)
|
||||||
}
|
}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
@@ -377,6 +377,59 @@ describe('given text representing a method, ', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when method parameter contains two generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes(List<T>, List<OT>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes(List<T>, List<OT>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes(List<T>, List<OT>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes(List<T>, List<OT>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when method parameter is a nested generic', function () {
|
describe('when method parameter is a nested generic', function () {
|
||||||
it('should parse correctly', function () {
|
it('should parse correctly', function () {
|
||||||
const str = `getTimetableList(List~List~T~~)`;
|
const str = `getTimetableList(List~List~T~~)`;
|
||||||
|
@@ -189,7 +189,7 @@ export const parseGenericTypes = function (text: string): string {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
cleanedText = newCleanedText;
|
cleanedText = newCleanedText;
|
||||||
newCleanedText = cleanedText.replace(/~([^:;]+)~/, '<$1>');
|
newCleanedText = cleanedText.replace(/~([^\s:;]+)~/, '<$1>');
|
||||||
} while (newCleanedText != cleanedText);
|
} while (newCleanedText != cleanedText);
|
||||||
|
|
||||||
return parseGenericTypes(newCleanedText);
|
return parseGenericTypes(newCleanedText);
|
||||||
|
Reference in New Issue
Block a user