-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #439 from whyzdev/flowchat_text
adde tests to reproduce #434 in flowchart
- Loading branch information
Showing
14 changed files
with
155 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ bower_components | |
|
||
.DS_Store | ||
.idea | ||
coverage | ||
coverage | ||
|
||
test/tmp_* | ||
test/fixtures/samples/*.actual.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use strict'; | ||
var exec = require('child_process').exec; | ||
var path = require('path') | ||
|
||
var test = require('tape') | ||
, rimraf = require('rimraf') | ||
|
||
var test_dir = 'test/fixtures/samples/'.replace('/',path.sep) | ||
|
||
rimraf.sync(test_dir+'*.actual.*'); | ||
|
||
function exec_mermaid(args, verify) { | ||
exec('bin/mermaid.js ' + args, | ||
{env: {PATH: './node_modules/.bin'+path.delimiter+process.env.PATH}}, | ||
function(error, stdout, stderr) { | ||
console.log('error:',error,'\nstdout:\n',stdout,'\nstderr:\n',stderr); | ||
verify(error, stdout, stderr); | ||
}); | ||
} | ||
|
||
test('mermaid cli help', function(t) { | ||
t.plan(1); | ||
var args = [ '--help' ] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.notOk(stderr, 'no error') | ||
t.end() | ||
}); | ||
}); | ||
|
||
test('mermaid cli help', function(t) { | ||
t.plan(1); | ||
var args = [ '--badopt' ] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.ok(stderr, 'should get error') | ||
t.end() | ||
}); | ||
}); | ||
|
||
//todo | ||
test.skip('sequence syntax error', function(t) { | ||
t.plan(1); | ||
var args = [ '--svg', | ||
'--outputDir=' + test_dir, | ||
'--outputSuffix=.actual', | ||
test_dir+'sequence_err.mmd' | ||
] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.ok(stderr, 'should get error') | ||
t.end() | ||
}); | ||
}); | ||
|
||
['', 'fo', 'tspan', 'old'].forEach(function(textPlacement) { | ||
test('sequence svg text placelment: '+textPlacement, function(t) { | ||
t.plan(1); | ||
var args = [ '--svg', | ||
'--outputDir=' + test_dir, | ||
'--outputSuffix='+(textPlacement ? '_'+textPlacement : '')+'.actual', | ||
textPlacement ? '--sequenceConfig='+test_dir+'sequence_text_'+textPlacement+'.cfg' : '', | ||
test_dir+'sequence_text.mmd' | ||
] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.notOk(stderr, 'no error') | ||
t.end() | ||
}); | ||
}) | ||
}); | ||
|
||
test('sequence png', function(t) { | ||
t.plan(1); | ||
var args = [ '--png', | ||
'--outputDir=' + test_dir, | ||
'--outputSuffix=.actual', | ||
test_dir+'sequence_text.mmd' | ||
] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.notOk(stderr, 'no error') | ||
t.end() | ||
}); | ||
}) | ||
|
||
test('flowchart svg text', function(t) { | ||
t.plan(1); | ||
var args = [ '--svg', | ||
'--outputDir=' + test_dir, | ||
'--outputSuffix=.actual', | ||
test_dir+'flowchart_text.mmd' | ||
] | ||
exec_mermaid(args.join(' '), function(error, stdout, stderr) { | ||
t.notOk(stderr, 'no error') | ||
t.end() | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
graph TD | ||
A[label] | ||
B[very very very long long long long-long-long text] | ||
A--test-->B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sequenceDiagram | ||
bad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sequenceDiagram | ||
participant A as actor | ||
participant B as very very very long long long long-long-long text | ||
A->>B: hi | ||
B-->A: | ||
B->>A: hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"textPlacement": "fo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"textPlacement": "old" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"textPlacement": "tspan" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
sequenceDiagram | ||
Alice->Bob: Hello Bob, how are you? | ||
Alice->>Bob: Hello Bob, how are you? | ||
Note right of Bob: Bob thinks | ||
Bob-->Alice: I am good thanks! | ||
Bob-->John the Long: How about you John? | ||
Bob-->Alice: Checking with John... | ||
Alice->John the Long: Yes... John, how are you? | ||
Bob-->>Alice: I am good thanks! | ||
Bob-->>John the Long: How about you John? | ||
Bob-->>Alice: Checking with John... | ||
Alice->>John the Long: Yes... John, how are you? | ||
John the Long-->Alice: Better than you! |