This commit is contained in:
Leo Horie 2016-07-21 00:52:32 -04:00
parent 6da4e973d8
commit 1155027c91
5 changed files with 170 additions and 132 deletions

View file

@ -174,6 +174,20 @@ o.spec("oncreate", function() {
o(callback.this).equals(updated.children[0].state)
o(callback.args[0]).equals(updated.children[0])
})
o("calls oncreate on unkeyed that falls into reverse list diff code path", function() {
var create = o.spy()
render(root, [{tag: "p"}, {tag: "div"}])
render(root, [{tag: "div", attrs: {oncreate: create}}, {tag: "div"}])
o(create.callCount).equals(1)
})
o("calls oncreate on unkeyed that falls into forward list diff code path", function() {
var create = o.spy()
render(root, [{tag: "div"}, {tag: "p"}])
render(root, [{tag: "div"}, {tag: "div", attrs: {oncreate: create}}])
o(create.callCount).equals(1)
})
o("calls oncreate after full DOM creation", function() {
var created = false
var vnode = {tag: "div", children: [

View file

@ -762,10 +762,10 @@ o.spec("updateNodes", function() {
o(vnodes[0].dom).equals(updated[0].dom)
o(updated[0].dom.nodeName).equals("DIV")
})
o("recycles when toggling", function() {
var vnodes = [{tag: "div", key: 1}]
var temp = [{tag: "div"}]
var updated = [{tag: "div", key: 1}]
o("recycles when not keyed", function() {
var vnodes = [{tag: "div"}]
var temp = []
var updated = [{tag: "div"}]
render(root, vnodes)
render(root, temp)