Skip to content

Commit

Permalink
added test case for issue HenrikJoreteg#40
Browse files Browse the repository at this point in the history
  • Loading branch information
ericponto committed Oct 13, 2020
1 parent 3a3ed62 commit 7f256d1
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,54 @@ test('parse', function (t) {
])
t.equal(html, HTML.stringify(parsed))

html = '<div class="oh"><p><span>hi</span></p><p>bye</p></div>'
parsed = HTML.parse(html)
t.deepEqual(parsed, [
{
type: 'tag',
name: 'div',
attrs: {
class: 'oh',
},
voidElement: false,
children: [
{
type: 'tag',
name: 'p',
attrs: {},
voidElement: false,
children: [
{
type: 'tag',
name: 'span',
attrs: {},
voidElement: false,
children: [
{
type: 'text',
content: 'hi',
},
],
},
],
},
{
type: 'tag',
name: 'p',
attrs: {},
voidElement: false,
children: [
{
type: 'text',
content: 'bye',
},
],
},
],
},
])
t.equal(html, HTML.stringify(parsed))

html = '<!-- just a comment node -->'
parsed = HTML.parse(html)
t.deepEqual(parsed, [
Expand Down

0 comments on commit 7f256d1

Please sign in to comment.