fix lifecycle in unkeyed child of recycled keyed
This commit is contained in:
parent
8feb6d3b39
commit
0d9a51fe37
3 changed files with 32 additions and 5 deletions
|
|
@ -55,7 +55,7 @@ o.spec("render", function() {
|
|||
|
||||
o(threwOuter).equals(true)
|
||||
})
|
||||
o("lifecycle methods work in children of recycled", function() {
|
||||
o("lifecycle methods work in keyed children of recycled keyed", function() {
|
||||
var createA = o.spy()
|
||||
var updateA = o.spy()
|
||||
var removeA = o.spy()
|
||||
|
|
@ -78,6 +78,34 @@ o.spec("render", function() {
|
|||
render(root, b())
|
||||
render(root, a())
|
||||
|
||||
o(createA.callCount).equals(2)
|
||||
o(updateA.callCount).equals(0)
|
||||
o(removeA.callCount).equals(1)
|
||||
o(createB.callCount).equals(1)
|
||||
o(updateB.callCount).equals(0)
|
||||
o(removeB.callCount).equals(1)
|
||||
})
|
||||
o("lifecycle methods work in unkeyed children of recycled keyed", function() {
|
||||
var createA = o.spy()
|
||||
var updateA = o.spy()
|
||||
var removeA = o.spy()
|
||||
var createB = o.spy()
|
||||
var updateB = o.spy()
|
||||
var removeB = o.spy()
|
||||
var a = function() {
|
||||
return {tag: "div", key: 1, children: [
|
||||
{tag: "div", attrs: {oncreate: createA, onupdate: updateA, onremove: removeA}},
|
||||
]}
|
||||
}
|
||||
var b = function() {
|
||||
return {tag: "div", key: 2, children: [
|
||||
{tag: "div", attrs: {oncreate: createB, onupdate: updateB, onremove: removeB}},
|
||||
]}
|
||||
}
|
||||
render(root, a())
|
||||
render(root, b())
|
||||
render(root, a())
|
||||
|
||||
o(createA.callCount).equals(2)
|
||||
o(updateA.callCount).equals(0)
|
||||
o(removeA.callCount).equals(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue