fix recycling when tag is different in unkeyed node

This commit is contained in:
Leo Horie 2016-07-12 11:30:58 -04:00
parent c196b8b475
commit 7227cc546f
3 changed files with 33 additions and 5 deletions

View file

@ -787,4 +787,30 @@ o.spec("updateNodes", function() {
o(vnodes[0].dom.firstChild).equals(updated[0].dom.firstChild)
o(updated[0].dom.firstChild.nodeName).equals("A")
})
o("mixed unkeyed tags are not broken by recycle", function() {
var vnodes = [{tag: "a"}, {tag: "b"}]
var temp = [{tag: "b"}]
var updated = [{tag: "a"}, {tag: "b"}]
render(root, vnodes)
render(root, temp)
render(root, updated)
o(root.childNodes.length).equals(2)
o(root.childNodes[0].nodeName).equals("A")
o(root.childNodes[1].nodeName).equals("B")
})
o("mixed unkeyed vnode types are not broken by recycle", function() {
var vnodes = [{tag: "[", children: [{tag: "a"}]}, {tag: "b"}]
var temp = [{tag: "b"}]
var updated = [{tag: "[", children: [{tag: "a"}]}, {tag: "b"}]
render(root, vnodes)
render(root, temp)
render(root, updated)
o(root.childNodes.length).equals(2)
o(root.childNodes[0].nodeName).equals("A")
o(root.childNodes[1].nodeName).equals("B")
})
})