add test for #200
This commit is contained in:
parent
61da8552c4
commit
808f926d20
1 changed files with 24 additions and 0 deletions
|
|
@ -720,6 +720,30 @@ function testMithril(mock) {
|
||||||
m.render(root, m("div", [m("div")]))
|
m.render(root, m("div", [m("div")]))
|
||||||
return root.childNodes[0].childNodes.length == 1
|
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
|
//end m.render
|
||||||
|
|
||||||
//m.redraw
|
//m.redraw
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue