2018-09-25 11:04:59 +08:00
|
|
|
/**
|
|
|
|
* Created by Estevao on 08-06-2015.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// jshint ignore: start
|
2022-04-28 15:38:48 +08:00
|
|
|
let bootstrap = require('./makehtml.bootstrap.js'),
|
|
|
|
converter = new bootstrap.showdown.Converter({
|
|
|
|
noHeaderId: true,
|
|
|
|
requireSpaceBeforeHeadingText: true
|
|
|
|
}),
|
2018-09-25 11:04:59 +08:00
|
|
|
assertion = bootstrap.assertion,
|
|
|
|
testsuite = bootstrap.getJsonTestSuite('test/functional/makehtml/cases/commonmark.testsuite.json');
|
2022-05-09 10:17:43 +08:00
|
|
|
const {tests} = require('commonmark-spec');
|
2018-09-25 11:04:59 +08:00
|
|
|
|
|
|
|
describe('makeHtml() commonmark testsuite', function () {
|
|
|
|
'use strict';
|
|
|
|
|
2022-04-28 15:38:48 +08:00
|
|
|
for (let section in testsuite) {
|
2018-09-25 11:04:59 +08:00
|
|
|
if (testsuite.hasOwnProperty(section)) {
|
|
|
|
describe(section, function () {
|
2022-04-28 15:38:48 +08:00
|
|
|
for (let i = 0; i < testsuite[section].length; ++i) {
|
|
|
|
let name = testsuite[section][i].name;
|
|
|
|
switch (name) {
|
|
|
|
case 'ATX headings_79': // empty headings don't make sense
|
2022-05-09 09:38:41 +08:00
|
|
|
case 'Setext headings_93': // spec says it cannot be lazy continuation but then proceeds to make it a lazy continuation.
|
2022-05-09 08:48:53 +08:00
|
|
|
case 'Thematic breaks_43': // malformed input of test case
|
|
|
|
case 'Thematic breaks_61': // hr inside lists does not make sense
|
2022-05-09 10:17:43 +08:00
|
|
|
case 'Fenced code blocks_146': // as of date, github doesn't support this so we don't either
|
2022-05-09 11:00:29 +08:00
|
|
|
//case 'Raw HTML_619': // breaks prettifier so the test fails
|
2022-04-28 15:38:48 +08:00
|
|
|
continue;
|
2022-05-09 10:17:43 +08:00
|
|
|
|
2022-05-09 08:48:53 +08:00
|
|
|
case 'Setext headings_91': //it's failing because the testcase converts " to " even though it's not supposed to
|
|
|
|
testsuite[section][i].expected = testsuite[section][i].expected.replace(/"/g, '"')
|
|
|
|
break;
|
2022-05-09 10:17:43 +08:00
|
|
|
|
|
|
|
case 'Fenced code blocks_142': // we use different classes to mark languages in fenced code blocks
|
|
|
|
case 'Fenced code blocks_143': // we use different classes to mark languages in fenced code blocks
|
|
|
|
testsuite[section][i].expected = testsuite[section][i].expected.replace('language-ruby', 'ruby language-ruby');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Fenced code blocks_144': // we use different classes to mark languages in fenced code blocks
|
|
|
|
testsuite[section][i].expected = testsuite[section][i].expected.replace('language-;', '; language-;');
|
|
|
|
break;
|
2022-05-09 11:00:29 +08:00
|
|
|
|
|
|
|
case 'Hard line breaks_638':
|
|
|
|
console.log(testsuite[section][i].input);
|
|
|
|
|
2022-04-28 15:38:48 +08:00
|
|
|
}
|
|
|
|
it(name, assertion(testsuite[section][i], converter, true));
|
2018-09-25 11:04:59 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|