Skip to content

Commit

Permalink
failing test for section parser handling consecutive lists of varying…
Browse files Browse the repository at this point in the history
… types
  • Loading branch information
kevinansfield committed Jan 16, 2019
1 parent 100c5fb commit 66d2120
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/unit/parsers/section-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,37 @@ test('#parse handles grouping nested lists', (assert) => {
assert.equal(list.items.objectAt(3).text, 'Outer-Four');
});

test('#parse handles grouping of consecutive lists of same type', (assert) => {
let container = buildDOM(`
<div><ul><li>One</li></ul><ul><li>Two</li></ul>
`);

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

assert.equal(sections.length, 1, 'single list section');
let list = sections[0];
assert.equal(list.items.objectAt(0).text, 'One');
assert.equal(list.items.objectAt(1).text, 'Two');
});

test('#parse doesn\'t group consecutive lists of different types', (assert) => {
let container = buildDOM(`
<div><ul><li>One</li></ul><ol><li>Two</li></ol>
`);

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

assert.equal(sections.length, 2, 'two list sections');
let ul = sections[0];
assert.equal(ul.items.objectAt(0).text, 'One');
let ol = sections[1];
assert.equal(ol.items.objectAt(0).text, 'Two');
});

test('#parse skips STYLE nodes', (assert) => {
let element = buildDOM(`
<style>.rule { font-color: red; }</style>
Expand Down

0 comments on commit 66d2120

Please sign in to comment.