mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-25 02:09:50 +02:00
Changes to gantt.html
1. Added a Gantt diagram that demonstrates to users that hashtages and semicolons can be added to titles, sections, and task data. Changes to gantt.spec.js 1. Added unit tests to ensure that semicolons and hashtags didn't break the functionality of the gantt diagram when used in titles, sections or task data. Changes to /parser/gantt.spec.js 1. Added rendering tests to ensure that semicolons and hashtags in titles, sections, and task data didn't break the rendering of Gantt diagrams.
This commit is contained in:
@@ -28,8 +28,12 @@ describe('when parsing a gantt diagram it', function () {
|
||||
});
|
||||
it('should handle a title definition', function () {
|
||||
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid';
|
||||
const semi = 'gantt\ndateFormat yyyy-mm-dd\ntitle ;Gantt diagram titles support semicolons';
|
||||
const hash = 'gantt\ndateFormat yyyy-mm-dd\ntitle #Gantt diagram titles support hashtags';
|
||||
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(parserFnConstructor(semi)).not.toThrow();
|
||||
expect(parserFnConstructor(hash)).not.toThrow();
|
||||
});
|
||||
it('should handle an excludes definition', function () {
|
||||
const str =
|
||||
@@ -53,7 +57,23 @@ describe('when parsing a gantt diagram it', function () {
|
||||
'excludes weekdays 2019-02-01\n' +
|
||||
'section Documentation';
|
||||
|
||||
const semi =
|
||||
'gantt\n' +
|
||||
'dateFormat yyyy-mm-dd\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'excludes weekdays 2019-02-01\n' +
|
||||
'section ;Documentation';
|
||||
|
||||
const hash =
|
||||
'gantt\n' +
|
||||
'dateFormat yyyy-mm-dd\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'excludes weekdays 2019-02-01\n' +
|
||||
'section #Documentation';
|
||||
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(parserFnConstructor(semi)).not.toThrow();
|
||||
expect(parserFnConstructor(hash)).not.toThrow();
|
||||
});
|
||||
it('should handle multiline section titles with different line breaks', function () {
|
||||
const str =
|
||||
@@ -73,7 +93,23 @@ describe('when parsing a gantt diagram it', function () {
|
||||
'section Documentation\n' +
|
||||
'Design jison grammar:des1, 2014-01-01, 2014-01-04';
|
||||
|
||||
const semi =
|
||||
'gantt\n' +
|
||||
'dateFormat YYYY-MM-DD\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'section Documentation\n' +
|
||||
';Design jison grammar:des1, 2014-01-01, 2014-01-04';
|
||||
|
||||
const hash =
|
||||
'gantt\n' +
|
||||
'dateFormat YYYY-MM-DD\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'section Documentation\n' +
|
||||
'#Design jison grammar:des1, 2014-01-01, 2014-01-04';
|
||||
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(parserFnConstructor(semi)).not.toThrow();
|
||||
expect(parserFnConstructor(hash)).not.toThrow();
|
||||
|
||||
const tasks = parser.yy.getTasks();
|
||||
|
||||
|
Reference in New Issue
Block a user