mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Test(emphasis): prove that emphasis mechanism is working correctly
This test scenario is related to issue #107
This commit is contained in:
parent
f938d2b8aa
commit
d4f619c666
11
test/issues/#107.inner_underscore_parse_to_block.html
Normal file
11
test/issues/#107.inner_underscore_parse_to_block.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<p>escaped word_with_underscores</p>
|
||||
|
||||
<p>escaped word__with__double underscores</p>
|
||||
|
||||
<p>escaped word<em>_with_</em>single italic underscore</p>
|
||||
|
||||
<p>escaped word*with*asterixs</p>
|
||||
|
||||
<p>escaped word**with**asterixs</p>
|
||||
|
||||
<p>escaped word<strong>*with*</strong>bold asterixs</p>
|
11
test/issues/#107.inner_underscore_parse_to_block.md
Normal file
11
test/issues/#107.inner_underscore_parse_to_block.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
escaped word\_with\_underscores
|
||||
|
||||
escaped word\_\_with\_\_double underscores
|
||||
|
||||
escaped word_\_with\__single italic underscore
|
||||
|
||||
escaped word\*with*asterixs
|
||||
|
||||
escaped word\*\*with\*\*asterixs
|
||||
|
||||
escaped word**\*with\***bold asterixs
|
|
@ -9,16 +9,40 @@
|
|||
require('chai').should();
|
||||
|
||||
var fs = require('fs'),
|
||||
dir = 'test/cases/',
|
||||
showdown = require('../../../dist/showdown.js'),
|
||||
converter = new showdown.Converter();
|
||||
converter = new showdown.Converter(),
|
||||
cases = fs
|
||||
.readdirSync('test/cases/')
|
||||
.filter(filter())
|
||||
.map(map('test/cases/')),
|
||||
issues = fs
|
||||
.readdirSync('test/issues/')
|
||||
.filter(filter())
|
||||
.map(map('test/issues/'));
|
||||
|
||||
// Load test cases from disk
|
||||
var cases = fs.readdirSync(dir).filter(function (file) {
|
||||
//Tests
|
||||
describe('Converter.makeHtml() simple testcases', function () {
|
||||
for (var i = 0; i < cases.length; ++i) {
|
||||
it(cases[i].name, assertion(cases[i]));
|
||||
}
|
||||
});
|
||||
|
||||
describe('Converter.makeHtml() issues testcase', function () {
|
||||
for (var i = 0; i < issues.length; ++i) {
|
||||
it(issues[i].name, assertion(issues[i]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function filter() {
|
||||
return function(file) {
|
||||
var ext = file.slice(-3);
|
||||
return (ext === '.md');
|
||||
}).map(function (file) {
|
||||
};
|
||||
}
|
||||
|
||||
function map(dir) {
|
||||
return function(file) {
|
||||
var name = file.replace('.md', ''),
|
||||
htmlPath = dir + name + '.html',
|
||||
html = fs.readFileSync(htmlPath, 'utf8'),
|
||||
|
@ -30,7 +54,8 @@
|
|||
input: md,
|
||||
expected: html
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
//Normalize input/output
|
||||
function normalize(testCase) {
|
||||
|
@ -69,12 +94,4 @@
|
|||
testCase.actual.should.equal(testCase.expected);
|
||||
};
|
||||
}
|
||||
|
||||
//Tests
|
||||
describe('Converter.makeHtml()', function () {
|
||||
for (var i = 0; i < cases.length; ++i) {
|
||||
it(cases[i].name, assertion(cases[i]));
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue
Block a user