mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-27 08:04:11 +01:00
chore: Fix gantt test
This commit is contained in:
@@ -157,30 +157,40 @@ describe('when parsing a gantt diagram it', function () {
|
||||
${'crit'} | ${false} | ${false} | ${true} | ${false}
|
||||
${'active'} | ${false} | ${false} | ${false} | ${true}
|
||||
${'crit,milestone,done'} | ${true} | ${true} | ${true} | ${false}
|
||||
`)('should handle a task with tags $tags', ({ tags }) => {
|
||||
const str =
|
||||
'gantt\n' +
|
||||
'dateFormat YYYY-MM-DD\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'section Documentation\n' +
|
||||
'test task:' +
|
||||
tags +
|
||||
', 2014-01-01, 2014-01-04';
|
||||
`)(
|
||||
'should handle a task with tags $tags',
|
||||
({
|
||||
tags,
|
||||
// Do not remove, these are used in eval.
|
||||
milestone,
|
||||
done,
|
||||
crit,
|
||||
active,
|
||||
}) => {
|
||||
const str =
|
||||
'gantt\n' +
|
||||
'dateFormat YYYY-MM-DD\n' +
|
||||
'title Adding gantt diagram functionality to mermaid\n' +
|
||||
'section Documentation\n' +
|
||||
'test task:' +
|
||||
tags +
|
||||
', 2014-01-01, 2014-01-04';
|
||||
|
||||
const allowedTags = ['active', 'done', 'crit', 'milestone'];
|
||||
const allowedTags = ['active', 'done', 'crit', 'milestone'];
|
||||
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
|
||||
const tasks = parser.yy.getTasks();
|
||||
const tasks = parser.yy.getTasks();
|
||||
|
||||
allowedTags.forEach(function (t) {
|
||||
if (eval(t)) {
|
||||
expect(tasks[0][t]).toBeTruthy();
|
||||
} else {
|
||||
expect(tasks[0][t]).toBeFalsy();
|
||||
}
|
||||
});
|
||||
});
|
||||
allowedTags.forEach(function (t) {
|
||||
if (eval(t)) {
|
||||
expect(tasks[0][t]).toBeTruthy();
|
||||
} else {
|
||||
expect(tasks[0][t]).toBeFalsy();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
it('should parse callback specifier with no args', function () {
|
||||
spyOn(ganttDb, 'setClickEvent');
|
||||
const str =
|
||||
|
||||
Reference in New Issue
Block a user