#463 don't try to manage 3rd party dom element when using keys

This commit is contained in:
Leo Horie 2015-03-13 23:22:54 -04:00
parent 8cc4a862fe
commit 904f4ee34a
2 changed files with 42 additions and 2 deletions

View file

@ -119,6 +119,44 @@ function testMithril(mock) {
return initCount == 1
})
test(function() {
var root = mock.document.createElement("div")
var dom = mock.document.createElement("div")
var show = true
var module = {
view: function() {
return [
m(".foo", {key: 1, config: test, onclick: function() {show = !show}}),
show ? m(".bar", {key: 2}) : null
]
}
}
function test(el, init) {
if (!init) {
root.appendChild(dom)
}
}
m.module(root, module)
mock.requestAnimationFrame.$resolve()
show = false
m.redraw()
mock.requestAnimationFrame.$resolve()
show = true
m.redraw()
mock.requestAnimationFrame.$resolve()
return root.childNodes.length == 3
})
m.redraw.strategy(undefined) //teardown for m.module tests
//m.withAttr