From 9656072b27737c4cf02b9889de7edfc2fdee6bba Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Sun, 11 Jan 2015 12:50:38 +0300 Subject: [PATCH] Coverage: added top api tests --- test/misc.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/test/misc.js b/test/misc.js index ccdf45c..7f1e9a2 100644 --- a/test/misc.js +++ b/test/misc.js @@ -9,9 +9,12 @@ describe('API', function () { it('constructor', function () { assert.throws(function () { - var md = markdownit('bad preset'); - md.render('123'); + markdownit('bad preset'); }); + + // options should override preset + var md = markdownit('commonmark', { html: false }); + assert.strictEqual(md.render(''), '

<!-- -->

\n'); }); it('configure coverage', function () { @@ -19,8 +22,11 @@ describe('API', function () { // conditions coverage md.configure({}); - assert.strictEqual(md.render('123'), '

123

\n'); + + assert.throws(function () { + md.configure(); + }); }); it('plugin', function () { @@ -112,7 +118,7 @@ describe('API', function () { assert.deepEqual(was, back); }); - it('bulk enable/dusable with errors control', function () { + it('bulk enable/disable with errors control', function () { var md = markdownit(); assert.throws(function () { @@ -129,6 +135,16 @@ describe('API', function () { }); }); + it('bulk enable/disable should understand strings', function () { + var md = markdownit(); + + md.disable('emphasis'); + assert(md.renderInline('_foo_'), '_foo_'); + + md.enable('emphasis'); + assert(md.renderInline('_foo_'), 'foo'); + }); + });