mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 03:04:07 +01:00
Better text handling for flowcharts
This commit is contained in:
49
src/utils.spec.js
Normal file
49
src/utils.spec.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Created by knut on 14-11-23.
|
||||
*/
|
||||
|
||||
describe('when detecting chart type ',function() {
|
||||
var utils = require('./utils');
|
||||
beforeEach(function () {
|
||||
|
||||
});
|
||||
|
||||
it('should handle a sequence defintion', function () {
|
||||
str = 'sequence TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('sequence');
|
||||
});
|
||||
it('should handle a sequence defintion with leading spaces', function () {
|
||||
str = ' sequence TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('sequence');
|
||||
});
|
||||
|
||||
it('should handle a graph defintion', function () {
|
||||
str = 'graph TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('graph');
|
||||
});
|
||||
it('should handle a graph defintion with leading spaces', function () {
|
||||
str = ' graph TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('graph');
|
||||
});
|
||||
|
||||
it('should handle a graph defintion with leading spaces and newline', function () {
|
||||
str = ' \n graph TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('graph');
|
||||
});
|
||||
it('should handle a sequence defintion with leading spaces and newline', function () {
|
||||
str = ' \n sequence TB\nbfs1:queue';
|
||||
|
||||
var type = utils.detectType(str);
|
||||
expect(type).toBe('sequence');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user