Browse Source

Coverage: added top api tests

pull/41/head
Vitaly Puzrin 10 years ago
parent
commit
9656072b27
  1. 24
      test/misc.js

24
test/misc.js

@ -9,9 +9,12 @@ describe('API', function () {
it('constructor', function () { it('constructor', function () {
assert.throws(function () { assert.throws(function () {
var md = markdownit('bad preset'); markdownit('bad preset');
md.render('123');
}); });
// options should override preset
var md = markdownit('commonmark', { html: false });
assert.strictEqual(md.render('<!-- -->'), '<p>&lt;!-- --&gt;</p>\n');
}); });
it('configure coverage', function () { it('configure coverage', function () {
@ -19,8 +22,11 @@ describe('API', function () {
// conditions coverage // conditions coverage
md.configure({}); md.configure({});
assert.strictEqual(md.render('123'), '<p>123</p>\n'); assert.strictEqual(md.render('123'), '<p>123</p>\n');
assert.throws(function () {
md.configure();
});
}); });
it('plugin', function () { it('plugin', function () {
@ -112,7 +118,7 @@ describe('API', function () {
assert.deepEqual(was, back); assert.deepEqual(was, back);
}); });
it('bulk enable/dusable with errors control', function () { it('bulk enable/disable with errors control', function () {
var md = markdownit(); var md = markdownit();
assert.throws(function () { 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_'), '<em>foo</em>');
});
}); });

Loading…
Cancel
Save