/** * Created by Estevao on 15-01-2015. */ (function () { 'use strict'; require('source-map-support').install(); require('chai').should(); var fs = require('fs'), showdown = require('../../../dist/showdown.js'), cases = fs.readdirSync('test/cases/') .filter(filter()) .map(map('test/cases/')), issues = fs.readdirSync('test/issues/') .filter(filter()) .map(map('test/issues/')), extra = fs.readdirSync('test/extra/') .filter(filter()) .map(map('test/extra/')); //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], converter)); } }); describe('Converter.makeHtml() EXTRA testcases', function () { var converter = new showdown.Converter(); for (var i = 0; i < extra.length; ++i) { it(extra[i].name, assertion(extra[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], 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 = '
' + text + '
';
html.should.equal(expectedHtml);
});
});
describe('Converter.options prefixHeaderId', function () {
var converter = new showdown.Converter(),
text = 'foo header';
it('should prefix header id with "section"', function () {
converter.setOption('prefixHeaderId', true);
var html = converter.makeHtml('# ' + text),
expectedHtml = '