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});
|
2016-08-20 02:12:25 +08:00
|
|
|
} else if (testsuite[i].name === '#284.simplifiedAutoLink-does-not-match-GFM-style') {
|
|
|
|
converter = new showdown.Converter({simplifiedAutoLink: true});
|
2016-11-11 16:15:24 +08:00
|
|
|
} else if (testsuite[i].name === 'disableForced4SpacesIndentedSublists') {
|
|
|
|
converter = new showdown.Converter({disableForced4SpacesIndentedSublists: true});
|
2016-12-01 02:04:17 +08:00
|
|
|
} else if (testsuite[i].name === '#206.treat-single-line-breaks-as-br') {
|
|
|
|
converter = new showdown.Converter({simpleLineBreaks: true});
|
2017-01-06 11:51:12 +08:00
|
|
|
} else if (testsuite[i].name === 'simpleLineBreaks2') {
|
|
|
|
converter = new showdown.Converter({simpleLineBreaks: true});
|
2016-12-21 07:57:10 +08:00
|
|
|
} else if (testsuite[i].name === '#316.new-simpleLineBreaks-option-breaks-lists') {
|
|
|
|
converter = new showdown.Converter({simpleLineBreaks: true});
|
2017-01-06 11:51:12 +08:00
|
|
|
} else if (testsuite[i].name === '#323.simpleLineBreaks-breaks-with-strong') {
|
|
|
|
converter = new showdown.Converter({simpleLineBreaks: true});
|
|
|
|
} else if (testsuite[i].name === '#318.simpleLineBreaks-does-not-work-with-chinese-characters') {
|
|
|
|
converter = new showdown.Converter({simpleLineBreaks: true});
|
2016-12-01 23:25:46 +08:00
|
|
|
} else if (testsuite[i].name === 'excludeTrailingPunctuationFromURLs-option') {
|
|
|
|
converter = new showdown.Converter({simplifiedAutoLink: true, excludeTrailingPunctuationFromURLs: true});
|
2016-12-17 14:01:15 +08:00
|
|
|
} else if (testsuite[i].name === 'requireSpaceBeforeHeadingText') {
|
|
|
|
converter = new showdown.Converter({requireSpaceBeforeHeadingText: true});
|
2016-12-31 03:01:44 +08:00
|
|
|
} else if (testsuite[i].name === '#320.github-compatible-generated-header-id') {
|
|
|
|
converter = new showdown.Converter({ghCompatibleHeaderId: true});
|
2017-01-06 12:33:12 +08:00
|
|
|
} else if (testsuite[i].name === 'ghMentions') {
|
|
|
|
converter = new showdown.Converter({ghMentions: true});
|
2017-01-28 03:03:37 +08:00
|
|
|
} else if (testsuite[i].name === 'disable-email-encoding') {
|
|
|
|
converter = new showdown.Converter({encodeEmails: false});
|
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
|
|
|
});
|