Skip to content

Commit

Permalink
add tests for dom and section parser ignoring blank markup sections
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield committed Jan 16, 2019
1 parent a5353ff commit 100c5fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/unit/parsers/dom-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ let expectations = [
['<p>first line</p>\n<p>second line</p>', ['first line','second line']],
['<p>first line</p>middle line<p>third line</p>', ['first line','middle line','third line']],
['<p>first line</p>second line', ['first line','second line']],
['<p>first line</p><p></p><p>third line</p>', ['first line', 'third line']],

['<b>bold text</b>',['*bold text*']],

Expand Down
14 changes: 14 additions & 0 deletions tests/unit/parsers/section-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ test('#parse only runs text nodes through parserPlugins once', (assert) => {
assert.equal(pluginRunCount, 1);
});

test('#parse ignores blank markup sections', assert => {
let container = buildDOM(`
<div><p>One</p><p></p><p>Three</p></div>
`);

let element = container.firstChild;
parser = new SectionParser(builder);
let sections = parser.parse(element);

assert.equal(sections.length, 2, 'Two sections');
assert.equal(sections[0].text, 'One');
assert.equal(sections[1].text, 'Three');
});

test("#parse handles single paragraph in list item", assert => {
let container = buildDOM(`
<ul><li><p>One</p></li>
Expand Down

0 comments on commit 100c5fb

Please sign in to comment.