document flag

This commit is contained in:
Leo Horie 2015-03-02 22:25:52 -05:00
parent 1a57bcc403
commit 71a19a27a9
3 changed files with 120 additions and 16 deletions

View file

@ -1783,6 +1783,48 @@ function testMithril(mock) {
mock.requestAnimationFrame.$resolve()
mock.location.search = "?"
var root = mock.document.createElement("div")
var value
var a = {}
a.controller = function() {}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
value = ctx.retain
}})
}
m.route(root, "/a", {
"/a": a
})
return value === false
})
test(function() {
mock.requestAnimationFrame.$resolve()
mock.location.search = "?"
var root = mock.document.createElement("div")
var value
var a = {}
a.controller = function() {m.redraw.strategy("diff")}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
value = ctx.retain
}})
}
m.route(root, "/a", {
"/a": a
})
return value === true
})
test(function() {
mock.requestAnimationFrame.$resolve()
mock.location.search = "?"
var root = mock.document.createElement("div")
var initCount = 0
@ -1790,7 +1832,7 @@ function testMithril(mock) {
a.controller = function() {}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}})
}
@ -1822,7 +1864,7 @@ function testMithril(mock) {
a.controller = function() {}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}})
}
@ -1885,7 +1927,7 @@ function testMithril(mock) {
a.controller = function() {m.redraw.strategy("diff")}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}})
}
@ -1917,7 +1959,7 @@ function testMithril(mock) {
a.controller = function() {m.redraw.strategy("diff")}
a.view = function() {
return m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}})
}
@ -1949,7 +1991,7 @@ function testMithril(mock) {
a.controller = function() {}
a.view = function() {
return m("div", m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}}))
}
@ -1958,7 +2000,7 @@ function testMithril(mock) {
b.controller = function() {}
b.view = function() {
return m("section", m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}}))
}
@ -1986,7 +2028,7 @@ function testMithril(mock) {
a.controller = function() {}
a.view = function() {
return m("div", m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}}))
}
@ -1995,7 +2037,7 @@ function testMithril(mock) {
b.controller = function() {}
b.view = function() {
return m("section", m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}}))
}
@ -2058,7 +2100,7 @@ function testMithril(mock) {
a.controller = function() {m.redraw.strategy("diff")}
a.view = function() {
return m("div", m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}}))
}
@ -2067,7 +2109,7 @@ function testMithril(mock) {
b.controller = function() {m.redraw.strategy("diff")}
b.view = function() {
return m("section", m("a", {config: function(el, init, ctx) {
ctx.reuse = true
ctx.retain = true
if (!init) initCount++
}}))
}
@ -2095,7 +2137,7 @@ function testMithril(mock) {
a.controller = function() {m.redraw.strategy("diff")}
a.view = function() {
return m("div", m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}}))
}
@ -2104,7 +2146,7 @@ function testMithril(mock) {
b.controller = function() {m.redraw.strategy("diff")}
b.view = function() {
return m("section", m("a", {config: function(el, init, ctx) {
ctx.reuse = false
ctx.retain = false
if (!init) initCount++
}}))
}