Skip to content

Commit

Permalink
Add test for unvisited added later siblings
Browse files Browse the repository at this point in the history
Closes GH-13.
  • Loading branch information
wooorm committed Jul 24, 2018
1 parent 8083f80 commit 693763e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,26 @@ test('unist-util-visit', function(t) {
}
)

t.test('should visit added nodes', function(st) {
var tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
var other = remark().parse('Another ~~sentence~~.').children[0]
var l = types.length + 5 // (p, text, delete, text, text)
var n = 0

visit(tree, visitor)

st.equal(n, l, 'should walk over all nodes')

st.end()

function visitor(node, index, parent) {
n++

if (n === 2) {
parent.children.push(other)
}
}
})

t.end()
})

0 comments on commit 693763e

Please sign in to comment.