2015-06-17 08:22:05 +08:00
|
|
|
/**
|
|
|
|
* Created by Estevao on 08-06-2015.
|
|
|
|
*/
|
2015-07-12 02:32:22 +08:00
|
|
|
var bootstrap = require('../bootstrap.js'),
|
|
|
|
showdown = bootstrap.showdown,
|
2015-06-17 08:22:05 +08:00
|
|
|
assertion = bootstrap.assertion,
|
2015-07-11 23:44:24 +08:00
|
|
|
testsuite = bootstrap.getTestSuite('test/features/'),
|
|
|
|
tableSuite = bootstrap.getTestSuite('test/features/tables/');
|
2015-06-17 08:22:05 +08:00
|
|
|
|
|
|
|
describe('makeHtml() features testsuite', function () {
|
|
|
|
'use strict';
|
|
|
|
for (var i = 0; i < testsuite.length; ++i) {
|
|
|
|
var converter;
|
2015-10-19 09:50:32 +08:00
|
|
|
if (testsuite[i].name === '#143.support-image-dimensions') {
|
2015-06-17 08:22:05 +08:00
|
|
|
converter = new showdown.Converter({parseImgDimensions: true});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (testsuite[i].name === '#69.header-level-start') {
|
2015-06-17 09:19:44 +08:00
|
|
|
converter = new showdown.Converter({headerLevelStart: 3});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (testsuite[i].name === '#164.1.simple-autolink' || testsuite[i].name === '#204.certain-links-with-at-and-dot-break-url') {
|
2015-07-11 09:42:53 +08:00
|
|
|
converter = new showdown.Converter({simplifiedAutoLink: true});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (testsuite[i].name === '#164.2.disallow-underscore-emphasis-mid-word') {
|
2015-07-11 22:45:58 +08:00
|
|
|
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
2015-10-30 08:58:56 +08:00
|
|
|
} else if (testsuite[i].name === '#164.3.strikethrough' || testsuite[i].name === '#214.escaped-markdown-chars-break-strikethrough') {
|
2015-07-11 22:59:06 +08:00
|
|
|
converter = new showdown.Converter({strikethrough: true});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (testsuite[i].name === 'disable-gh-codeblocks') {
|
2015-07-12 03:33:11 +08:00
|
|
|
converter = new showdown.Converter({ghCodeBlocks: false});
|
2015-07-12 06:02:02 +08:00
|
|
|
} else if (testsuite[i].name === '#164.4.tasklists') {
|
|
|
|
converter = new showdown.Converter({tasklists: true});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (testsuite[i].name === 'autolink-and-disallow-underscores') {
|
2015-07-15 03:53:28 +08:00
|
|
|
converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true});
|
2015-10-19 10:09:50 +08:00
|
|
|
} else if (testsuite[i].name === '#198.literalMidWordUnderscores-changes-behavior-of-asterisk') {
|
|
|
|
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
2016-06-07 08:23:52 +08:00
|
|
|
} else if (testsuite[i].name === '#259.es6-template-strings-indentation-issues') {
|
|
|
|
converter = new showdown.Converter({smartIndentationFix: true});
|
2015-06-17 08:22:05 +08:00
|
|
|
} else {
|
|
|
|
converter = new showdown.Converter();
|
|
|
|
}
|
2015-10-19 09:50:32 +08:00
|
|
|
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
2015-06-17 08:22:05 +08:00
|
|
|
}
|
2015-07-11 23:44:24 +08:00
|
|
|
|
|
|
|
describe('table support', function () {
|
2015-07-12 01:21:43 +08:00
|
|
|
var converter;
|
2015-07-11 23:44:24 +08:00
|
|
|
for (var i = 0; i < tableSuite.length; ++i) {
|
2015-10-19 09:50:32 +08:00
|
|
|
if (tableSuite[i].name === 'basic-with-header-ids') {
|
2015-07-12 01:21:43 +08:00
|
|
|
converter = new showdown.Converter({tables: true, tableHeaderId: true});
|
2015-10-19 09:50:32 +08:00
|
|
|
} else if (tableSuite[i].name === '#179.parse-md-in-table-ths') {
|
2015-07-22 19:03:38 +08:00
|
|
|
converter = new showdown.Converter({tables: true, strikethrough: true});
|
2015-07-12 01:21:43 +08:00
|
|
|
} else {
|
|
|
|
converter = new showdown.Converter({tables: true});
|
|
|
|
}
|
2015-10-19 09:50:32 +08:00
|
|
|
it(tableSuite[i].name.replace(/-/g, ' '), assertion(tableSuite[i], converter));
|
2015-07-11 23:44:24 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-06-17 08:22:05 +08:00
|
|
|
});
|