fix child caching from undefined to array

This commit is contained in:
Leo Horie 2014-08-16 17:56:24 -04:00
parent 936e2034a7
commit a42dc113a4
2 changed files with 26 additions and 13 deletions

View file

@ -706,6 +706,20 @@ function testMithril(mock) {
m.render(root, m("ul", [m("li", {key: 0}), m("li", {key: 1}), m("li", {key: 2}), m("li", {key: 4}), m("li", {key: 5})]))
return root.childNodes[0].childNodes.map(function(n) {return n.key}).join("") == "01245"
})
test(function() {
//https://github.com/lhorie/mithril.js/issues/206
var root = mock.document.createElement("div")
m.render(root, m("div", undefined))
m.render(root, m("div", [m("div")]))
return root.childNodes[0].childNodes.length == 1
})
test(function() {
//https://github.com/lhorie/mithril.js/issues/206
var root = mock.document.createElement("div")
m.render(root, m("div", null))
m.render(root, m("div", [m("div")]))
return root.childNodes[0].childNodes.length == 1
})
//end m.render
//m.redraw