add support for controller.prototype.onunload
This commit is contained in:
parent
762eeb7e31
commit
b23ffd1aee
7 changed files with 86 additions and 6 deletions
|
|
@ -345,6 +345,7 @@ function testMithril(mock) {
|
|||
return valueBefore1 === "UL" && valueAfter1 === "" && valueBefore2 === "" && valueAfter2 === "UL"
|
||||
})
|
||||
test(function() {
|
||||
//https://github.com/lhorie/mithril.js/issues/79
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("div", {style: {background: "red"}}))
|
||||
var valueBefore = root.childNodes[0].style.background
|
||||
|
|
@ -357,6 +358,25 @@ function testMithril(mock) {
|
|||
m.render(root, m("div[style='background:red']"))
|
||||
return root.childNodes[0].style === "background:red"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("div", {style: {background: "red"}}))
|
||||
var valueBefore = root.childNodes[0].style.background
|
||||
m.render(root, m("div", {}))
|
||||
var valueAfter = root.childNodes[0].style.background
|
||||
return valueBefore === "red" && valueAfter === undefined
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
var module = {}, unloaded = false
|
||||
module.controller = function() {
|
||||
this.onunload = function() {unloaded = true}
|
||||
}
|
||||
module.view = function() {}
|
||||
m.module(root, module)
|
||||
m.module(root, {controller: function() {}, view: function() {}})
|
||||
return unloaded === true
|
||||
})
|
||||
//end m.render
|
||||
|
||||
//m.redraw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue