add test for #200

This commit is contained in:
Leo Horie 2014-08-16 18:04:45 -04:00
parent 61da8552c4
commit 808f926d20

View file

@ -720,6 +720,30 @@ function testMithril(mock) {
m.render(root, m("div", [m("div")]))
return root.childNodes[0].childNodes.length == 1
})
test(function() {
//https://github.com/lhorie/mithril.js/issues/200
var root = mock.document.createElement("div")
var unloaded1 = false
function unloadable1(element, isInit, context) {
context.onunload = function() {
unloaded1 = true
}
}
m.render(root, [ m("div", {config: unloadable1}) ])
m.render(root, [ ])
var unloaded2 = false
function unloadable2(element, isInit, context) {
context.onunload = function() {
unloaded2 = true
}
}
m.render(root, [ m("div", {config: unloadable2}) ])
m.render(root, [ ])
return unloaded1 === true && unloaded2 === true
})
//end m.render
//m.redraw