Release 0.2.6
* Default shape set to rect when none is set
This commit is contained in:
parent
9a35844731
commit
0c87128902
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mermaid",
|
"name": "mermaid",
|
||||||
"version": "0.2.5",
|
"version": "0.2.6",
|
||||||
"authors": [
|
"authors": [
|
||||||
"knsv <knut@sveido.com>"
|
"knsv <knut@sveido.com>"
|
||||||
],
|
],
|
||||||
|
|
|
@ -712,7 +712,7 @@ var addVertices = function (vert, g) {
|
||||||
style = styleFromStyleArr(style, vertice.styles);
|
style = styleFromStyleArr(style, vertice.styles);
|
||||||
|
|
||||||
// Use vertice id as text in the box if no text is provided by the graph definition
|
// Use vertice id as text in the box if no text is provided by the graph definition
|
||||||
if (vertice.text === undefined) {
|
if (typeof vertice.text === 'undefined') {
|
||||||
verticeText = vertice.id;
|
verticeText = vertice.id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -740,8 +740,9 @@ var addVertices = function (vert, g) {
|
||||||
case 'circle':
|
case 'circle':
|
||||||
_shape = 'circle';
|
_shape = 'circle';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
_shape = 'rect';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the node
|
// Add the node
|
||||||
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
||||||
});
|
});
|
||||||
|
@ -958,12 +959,14 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.tester = function(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version management
|
* Version management
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
exports.version = function(){
|
exports.version = function(){
|
||||||
return '0.2.5';
|
return '0.2.6';
|
||||||
};
|
};
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -680,7 +680,7 @@ var addVertices = function (vert, g) {
|
||||||
style = styleFromStyleArr(style, vertice.styles);
|
style = styleFromStyleArr(style, vertice.styles);
|
||||||
|
|
||||||
// Use vertice id as text in the box if no text is provided by the graph definition
|
// Use vertice id as text in the box if no text is provided by the graph definition
|
||||||
if (vertice.text === undefined) {
|
if (typeof vertice.text === 'undefined') {
|
||||||
verticeText = vertice.id;
|
verticeText = vertice.id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -708,8 +708,9 @@ var addVertices = function (vert, g) {
|
||||||
case 'circle':
|
case 'circle':
|
||||||
_shape = 'circle';
|
_shape = 'circle';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
_shape = 'rect';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the node
|
// Add the node
|
||||||
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
||||||
});
|
});
|
||||||
|
@ -926,12 +927,14 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.tester = function(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version management
|
* Version management
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
exports.version = function(){
|
exports.version = function(){
|
||||||
return '0.2.5';
|
return '0.2.6';
|
||||||
};
|
};
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -50,7 +50,7 @@ var addVertices = function (vert, g) {
|
||||||
style = styleFromStyleArr(style, vertice.styles);
|
style = styleFromStyleArr(style, vertice.styles);
|
||||||
|
|
||||||
// Use vertice id as text in the box if no text is provided by the graph definition
|
// Use vertice id as text in the box if no text is provided by the graph definition
|
||||||
if (vertice.text === undefined) {
|
if (typeof vertice.text === 'undefined') {
|
||||||
verticeText = vertice.id;
|
verticeText = vertice.id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -78,8 +78,9 @@ var addVertices = function (vert, g) {
|
||||||
case 'circle':
|
case 'circle':
|
||||||
_shape = 'circle';
|
_shape = 'circle';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
_shape = 'rect';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the node
|
// Add the node
|
||||||
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
g.setNode(vertice.id, {labelType: "html",shape:_shape, label: verticeText, rx: radious, ry: radious, style: style, id:vertice.id});
|
||||||
});
|
});
|
||||||
|
@ -296,12 +297,14 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.tester = function(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version management
|
* Version management
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
exports.version = function(){
|
exports.version = function(){
|
||||||
return '0.2.5';
|
return '0.2.6';
|
||||||
};
|
};
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
|
|
|
@ -7,38 +7,62 @@
|
||||||
var rewire = require("rewire");
|
var rewire = require("rewire");
|
||||||
var utils = require("./utils");
|
var utils = require("./utils");
|
||||||
|
|
||||||
describe('when detecting chart type ',function() {
|
describe('when using main and ',function() {
|
||||||
var main;
|
describe('when detecting chart type ',function() {
|
||||||
beforeEach(function () {
|
var main;
|
||||||
var MockBrowser = require('mock-browser').mocks.MockBrowser;
|
beforeEach(function () {
|
||||||
var mock = new MockBrowser();
|
var MockBrowser = require('mock-browser').mocks.MockBrowser;
|
||||||
|
var mock = new MockBrowser();
|
||||||
|
|
||||||
// and in the run-code inside some object
|
// and in the run-code inside some object
|
||||||
document = mock.getDocument();
|
document = mock.getDocument();
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
it('should have a version', function () {
|
||||||
|
div = document.createElement('div');
|
||||||
|
mermaid_config ={startOnLoad : false};
|
||||||
|
main = rewire('./main');
|
||||||
|
expect(main.version()).toBe('0.2.6');
|
||||||
|
});
|
||||||
|
it('should not call start anything with an empty document', function () {
|
||||||
|
|
||||||
|
mermaid_config ={startOnLoad : false};
|
||||||
|
main = rewire('./main');
|
||||||
|
|
||||||
|
spyOn(utils,'detectType');
|
||||||
|
expect(utils.detectType).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
it('should start something with a mermaid document', function () {
|
||||||
|
mermaid_config ={startOnLoad : false};
|
||||||
|
main = rewire('./main');
|
||||||
|
|
||||||
|
document.body.innerHTML = '<div class="mermaid"></div>';
|
||||||
|
spyOn(utils,'detectType');
|
||||||
|
mermaid.init();
|
||||||
|
expect(utils.detectType).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
it('should have a version', function () {
|
|
||||||
div = document.createElement('div');
|
|
||||||
mermaid_config ={startOnLoad : false};
|
|
||||||
main = rewire('./main');
|
|
||||||
expect(main.version()).toBe('0.2.5');
|
|
||||||
});
|
|
||||||
it('should not call start anything with an empty document', function () {
|
|
||||||
|
|
||||||
mermaid_config ={startOnLoad : false};
|
xdescribe('when calling addEdges ',function() {
|
||||||
main = rewire('./main');
|
var main;
|
||||||
|
beforeEach(function () {
|
||||||
|
main = rewire('./main');
|
||||||
|
});
|
||||||
|
it('should have a version', function () {
|
||||||
|
var edge = {start: 'start', end: 'end', type: 'arrow', text: 'test text'};
|
||||||
|
var edges = [edge];
|
||||||
|
var mockG = {
|
||||||
|
setEdge:function(start, end,options,name){}
|
||||||
|
};
|
||||||
|
spyOn(mockG,'setEdge');
|
||||||
|
main.__set__('exports.apa',function(a,b){
|
||||||
|
addEdges(a,b);
|
||||||
|
});
|
||||||
|
main.apa(edges,mockG);
|
||||||
|
expect(mockG.setEdge).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
spyOn(utils,'detectType');
|
|
||||||
expect(utils.detectType).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
it('should start something with a mermaid document', function () {
|
|
||||||
mermaid_config ={startOnLoad : false};
|
|
||||||
main = rewire('./main');
|
|
||||||
|
|
||||||
document.body.innerHTML = '<div class="mermaid"></div>';
|
|
||||||
spyOn(utils,'detectType');
|
|
||||||
mermaid.init();
|
|
||||||
expect(utils.detectType).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -34,19 +34,19 @@
|
||||||
E-->I[Ingvild];
|
E-->I[Ingvild];
|
||||||
click A apa;
|
click A apa;
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid">
|
<div class="mermaid2">
|
||||||
graph TD;
|
graph TD;
|
||||||
id1>This is the text in the box];
|
id1>This is the text in the box];
|
||||||
</div>
|
</div>
|
||||||
<h1>Shapes</h1>
|
<h1>Shapes</h1>
|
||||||
<div class="mermaidw">
|
<div class="mermaid">
|
||||||
graph TD;
|
graph TD;
|
||||||
sq[Square shape]-->ci((Circle shape));
|
sq[Square shape]-->ci((Circle shape));
|
||||||
od>Odd shape]---|Two line<br>edge comment|ro;
|
od>Odd shape]---|Two line<br>edge comment|ro;
|
||||||
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape];
|
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape];
|
||||||
di{Diamond is <br/> broken}-->ro(Rounded<br>square<br>shape);
|
di{Diamond is <br/> broken}-->ro(Rounded<br>square<br>shape);
|
||||||
di-->ro2(Rounded square shape);
|
di-->ro2(Rounded square shape);
|
||||||
e((Inner circle));
|
e((Inner circle))-->f;
|
||||||
style e red;
|
style e red;
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue