2017-04-11 16:57:57 +02:00
|
|
|
/* eslint-env jasmine */
|
2017-09-10 15:23:04 +02:00
|
|
|
import { parser } from './parser/gantt'
|
|
|
|
import ganttDb from './ganttDb'
|
|
|
|
|
2017-04-11 16:14:25 +02:00
|
|
|
describe('when parsing a gantt diagram it', function () {
|
|
|
|
beforeEach(function () {
|
2017-09-10 15:23:04 +02:00
|
|
|
parser.yy = ganttDb
|
2017-04-11 16:14:25 +02:00
|
|
|
})
|
|
|
|
|
2017-11-18 16:18:24 +01:00
|
|
|
it('should handle a dateFormat definition', function () {
|
2017-09-14 14:27:52 +02:00
|
|
|
const str = 'gantt\ndateFormat yyyy-mm-dd'
|
2017-04-11 16:14:25 +02:00
|
|
|
|
2017-09-10 15:23:04 +02:00
|
|
|
parser.parse(str)
|
2017-04-11 16:14:25 +02:00
|
|
|
})
|
2017-11-18 16:22:49 +01:00
|
|
|
it('should handle a title definition', function () {
|
2017-09-14 14:27:52 +02:00
|
|
|
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'
|
2017-04-11 16:14:25 +02:00
|
|
|
|
2017-09-10 15:23:04 +02:00
|
|
|
parser.parse(str)
|
2017-04-11 16:14:25 +02:00
|
|
|
})
|
2017-11-18 16:18:24 +01:00
|
|
|
it('should handle a section definition', function () {
|
2017-11-18 16:22:49 +01:00
|
|
|
const str = 'gantt\n' +
|
|
|
|
'dateFormat yyyy-mm-dd\n' +
|
|
|
|
'title Adding gantt diagram functionality to mermaid\n' +
|
|
|
|
'section Documentation'
|
2017-04-11 16:14:25 +02:00
|
|
|
|
2017-09-10 15:23:04 +02:00
|
|
|
parser.parse(str)
|
2017-04-11 16:14:25 +02:00
|
|
|
})
|
2017-04-16 17:48:36 +02:00
|
|
|
/**
|
|
|
|
* Beslutsflöde inligt nedan. Obs bla bla bla
|
|
|
|
* ```
|
|
|
|
* graph TD
|
|
|
|
* A[Hard pledge] -- text on link -->B(Round edge)
|
|
|
|
* B --> C{to do or not to do}
|
|
|
|
* C -->|Too| D[Result one]
|
|
|
|
* C -->|Doo| E[Result two]
|
|
|
|
```
|
|
|
|
* params bapa - a unique bapap
|
|
|
|
*/
|
2017-04-11 16:14:25 +02:00
|
|
|
it('should handle a task definition', function () {
|
2017-09-14 14:27:52 +02:00
|
|
|
const str = 'gantt\n' +
|
2017-04-16 17:48:36 +02:00
|
|
|
'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'
|
2015-02-08 20:07:15 +01:00
|
|
|
|
2017-09-10 15:23:04 +02:00
|
|
|
parser.parse(str)
|
2017-04-11 16:14:25 +02:00
|
|
|
})
|
|
|
|
})
|