#420 allow unloading of modules

This commit is contained in:
Leo Horie 2015-01-19 22:29:12 -05:00
parent fed82b2135
commit a04d67500e
3 changed files with 34 additions and 4 deletions

View file

@ -55,6 +55,29 @@ function testMithril(mock) {
return (root1.childNodes[0].nodeValue === "test1" && root2.childNodes[0].nodeValue === "test2")
&& (mod1.value && mod1.value === "test1") && (mod2.value && mod2.value === "test2")
})
test(function() {
mock.requestAnimationFrame.$resolve()
var root = mock.document.createElement("div")
var unloaded = false
var mod = m.module(root, {
controller: function() {
this.value = "test1"
this.onunload = function() {
unloaded = true
}
},
view: function(ctrl) {return ctrl.value}
})
mock.requestAnimationFrame.$resolve()
m.module(root, null)
mock.requestAnimationFrame.$resolve()
return unloaded
})
//m.withAttr
test(function() {