mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-16 18:54:12 +01:00
Adds CSS option to the CLI
This commit is contained in:
@@ -80,6 +80,35 @@ test('output of multiple svg', function(t) {
|
||||
})
|
||||
})
|
||||
|
||||
test('output including CSS', function(t) {
|
||||
t.plan(5)
|
||||
|
||||
var expected = ['test.mermaid.png']
|
||||
, opt = clone(singleFile)
|
||||
, filename
|
||||
, one
|
||||
, two
|
||||
|
||||
opt.png = true
|
||||
|
||||
mermaid.process(opt.files, opt, function(code) {
|
||||
t.equal(code, 0, 'has clean exit code')
|
||||
filename = path.join(opt.outputDir, path.basename(expected[0]))
|
||||
one = fs.statSync(filename)
|
||||
|
||||
opt.css = fs.readFileSync('test/fixtures/test.css', 'utf8')
|
||||
|
||||
mermaid.process(opt.files, opt, function(code) {
|
||||
t.equal(code, 0, 'has clean exit code')
|
||||
two = fs.statSync(filename)
|
||||
|
||||
t.notEqual(one.size, two.size)
|
||||
|
||||
verifyFiles(expected, opt.outputDir, t)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
function verifyFiles(expected, dir, t) {
|
||||
async.each(
|
||||
expected
|
||||
|
||||
@@ -71,6 +71,18 @@ test('setting an output directory succeeds', function(t) {
|
||||
})
|
||||
})
|
||||
|
||||
test('setting a css source file succeeds', function(t) {
|
||||
t.plan(1)
|
||||
|
||||
var cli = require(cliPath)
|
||||
, argv = ['-t', 'test/fixtures/test.css']
|
||||
|
||||
cli.parse(argv, function(err, msg, opt) {
|
||||
t.ok(opt.css, 'css file is populated')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('setting an output directory incorrectly causes an error', function(t) {
|
||||
t.plan(1)
|
||||
|
||||
|
||||
3
test/fixtures/test.css
vendored
Normal file
3
test/fixtures/test.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
body {
|
||||
background: #f00;
|
||||
}
|
||||
Reference in New Issue
Block a user