add space to task regex and disable xhtml for gfm testing

This commit is contained in:
Tom Theisen 2018-05-03 19:51:31 -07:00
parent 409cb0d841
commit aa73bb6ea7
3 changed files with 5 additions and 8 deletions

View File

@ -366,11 +366,11 @@ Lexer.prototype.token = function(src, top) {
} }
// Check for task list items // Check for task list items
istask = /^\[[ xX]\]/.test(item); istask = /^\[[ xX]\] /.test(item);
ischecked = undefined; ischecked = undefined;
if (istask) { if (istask) {
ischecked = item[1] !== ' '; ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] */, ''); item = item.replace(/^\[[ xX]\] +/, '');
} }
this.tokens.push({ this.tokens.push({

View File

@ -15,8 +15,7 @@ Messenger.prototype.test = function(spec, section, ignore) {
var shouldFail = ~ignore.indexOf(spec.example); var shouldFail = ~ignore.indexOf(spec.example);
it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() { it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() {
var expected = spec.html; var expected = spec.html;
var usexhtml = typeof spec.xhtml === 'boolean' ? spec.xhtml : true; var actual = marked(spec.markdown, { headerIds: false, xhtml: false });
var actual = marked(spec.markdown, { headerIds: false, xhtml: usexhtml });
since(messenger.message(spec, expected, actual)).expect( since(messenger.message(spec, expected, actual)).expect(
htmlDiffer.isEqual(expected, actual) htmlDiffer.isEqual(expected, actual)
).toEqual(!shouldFail); ).toEqual(!shouldFail);

View File

@ -51,15 +51,13 @@
"section": "Task list items", "section": "Task list items",
"html": "<ul>\n<li><input disabled=\"\" type=\"checkbox\"> foo</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> bar</li>\n</ul>", "html": "<ul>\n<li><input disabled=\"\" type=\"checkbox\"> foo</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> bar</li>\n</ul>",
"markdown": "- [ ] foo\n- [x] bar", "markdown": "- [ ] foo\n- [x] bar",
"example": 272, "example": 272
"xhtml": false
}, },
{ {
"section": "Task list items", "section": "Task list items",
"html": "<ul>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> foo\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> bar</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> baz</li>\n</ul>\n</li>\n<li><input disabled=\"\" type=\"checkbox\"> bim</li>\n</ul>", "html": "<ul>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> foo\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> bar</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> baz</li>\n</ul>\n</li>\n<li><input disabled=\"\" type=\"checkbox\"> bim</li>\n</ul>",
"markdown": "- [x] foo\n - [ ] bar\n - [x] baz\n- [ ] bim", "markdown": "- [x] foo\n - [ ] bar\n - [x] baz\n- [ ] bim",
"example": 273, "example": 273
"xhtml": false
}, },
{ {
"section": "Strikethrough", "section": "Strikethrough",