prevent recycling for vnodes w/ integration methods
This commit is contained in:
parent
73cfe3dd7a
commit
b4903538f3
6 changed files with 35 additions and 16 deletions
|
|
@ -156,4 +156,15 @@ o.spec("onbeforeremove", function() {
|
|||
o(vnode.dom.onbeforeremove).equals(undefined)
|
||||
o(vnode.dom.attributes["onbeforeremove"]).equals(undefined)
|
||||
})
|
||||
o("does not recycle when there's an onbeforeremove", function() {
|
||||
var remove = function(vnode, done) {done()}
|
||||
var vnode = {tag: "div", key: 1, attrs: {onbeforeremove: remove}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onbeforeremove: remove}}
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
})
|
||||
|
|
@ -138,7 +138,7 @@ o.spec("oncreate", function() {
|
|||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
})
|
||||
o("calls oncreate when recycling", function() {
|
||||
o("does not recycle when there's an oncreate", function() {
|
||||
var create = o.spy()
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {oncreate: create}, state: {}}
|
||||
|
|
@ -148,12 +148,12 @@ o.spec("oncreate", function() {
|
|||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
o(vnode.dom).equals(updated.dom)
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
o(update.this).equals(updated.state)
|
||||
o(update.args[0]).equals(updated)
|
||||
})
|
||||
o("calls oncreate at the same step as onupdate", function() {
|
||||
|
|
|
|||
|
|
@ -100,4 +100,15 @@ o.spec("onremove", function() {
|
|||
|
||||
o(remove.callCount).equals(1)
|
||||
})
|
||||
o("does not recycle when there's an onremove", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {onremove: remove}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onremove: remove}}
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
})
|
||||
|
|
@ -46,19 +46,16 @@ o.spec("onupdate", function() {
|
|||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(0)
|
||||
})
|
||||
o("does not call onupdate when recycling", function() {
|
||||
var create = o.spy()
|
||||
o("does not recycle when there's an onupdate", function() {
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {onupdate: create}}
|
||||
var vnode = {tag: "div", key: 1, attrs: {onupdate: update}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onupdate: update}}
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
o(vnode.dom).equals(updated.dom)
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(0)
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
o("does not call old onupdate when removing the onupdate property in new vnode", function() {
|
||||
var create = o.spy()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue