Skip to content

Commit

Permalink
test(options.omitExtraWLInCodeBlocks): add test for options.omitExtra…
Browse files Browse the repository at this point in the history
…WLInCodeBlocks
  • Loading branch information
tivie committed May 26, 2015
1 parent e6f40e1 commit 141e3f5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/node/Container/testMakeHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

var fs = require('fs'),
showdown = require('../../../dist/showdown.js'),
converter = new showdown.Converter(),
cases = fs.readdirSync('test/cases/')
.filter(filter())
.map(map('test/cases/')),
Expand All @@ -20,17 +19,34 @@

//Tests
describe('Converter.makeHtml() simple testcases', function () {
var converter = new showdown.Converter();
for (var i = 0; i < cases.length; ++i) {
it(cases[i].name, assertion(cases[i]));
if (cases[i].name === 'github-style-at-start') {
console.log(showdown.getOptions());
}
it(cases[i].name, assertion(cases[i], converter));
}
});

describe('Converter.makeHtml() issues testcase', function () {
var converter = new showdown.Converter();
for (var i = 0; i < issues.length; ++i) {
it(issues[i].name, assertion(issues[i]));
it(issues[i].name, assertion(issues[i], converter));
}
});

describe('Converter.options omitExtraWLInCodeBlocks', function () {
var converter = new showdown.Converter({omitExtraWLInCodeBlocks: true}),
text = 'var foo = bar;',
html = converter.makeHtml(' ' + text);
it('should omit extra line after code tag', function () {
var expectedHtml = '<pre><code>' + text + '</code></pre>';

// Compare
html.should.equal(expectedHtml);
});
});

function filter() {
return function (file) {
var ext = file.slice(-3);
Expand Down Expand Up @@ -82,7 +98,7 @@

}

function assertion(testCase) {
function assertion(testCase, converter) {
return function () {
testCase.actual = converter.makeHtml(testCase.input);
testCase = normalize(testCase);
Expand Down

0 comments on commit 141e3f5

Please sign in to comment.