Tests: add a test for onbeforeupdate and recycled nodes

This commit is contained in:
Pierre-Yves Gerardy 2017-02-20 20:29:18 +01:00
parent e496f7bfa6
commit 6a7144fc89

View file

@ -120,6 +120,21 @@ o.spec("onbeforeupdate", function() {
o(count).equals(1)
})
o("doesn't fire on recycled nodes", function() {
var onbeforeupdate = o.spy()
var vnodes = [{tag: "div", key: 1}]
var temp = []
var updated = [{tag: "div", key: 1, attrs: {onbeforeupdate: onbeforeupdate}}]
render(root, vnodes)
render(root, temp)
render(root, updated)
o(vnodes[0].dom).equals(updated[0].dom)
o(updated[0].dom.nodeName).equals("DIV")
o(onbeforeupdate.callCount).equals(0)
})
components.forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create