add {subtree: "retain"} flag to allow skipping diff from app space

This commit is contained in:
Leo Horie 2014-04-06 15:20:21 -04:00
parent c4494bf2ce
commit fcf77dfa44
12 changed files with 169 additions and 11 deletions

View file

@ -111,6 +111,36 @@ function testMithril(mock) {
m.render(root, m("div", [m("a", {href: "/second"})]))
return root.childNodes[0].childNodes.length == 1
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, m("ul", [m("li")]))
m.render(root, m("ul", [m("li"), undefined]))
return root.childNodes[0].childNodes.length === 1
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, m("ul", [m("li"), m("li")]))
m.render(root, m("ul", [m("li"), undefined]))
return root.childNodes[0].childNodes.length === 1
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, m("ul", [m("li")]))
m.render(root, m("ul", [undefined]))
return root.childNodes[0].childNodes.length === 0
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, m("ul", [m("li")]))
m.render(root, m("ul", [{}]))
return root.childNodes[0].childNodes.length === 0
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, m("ul", [m("li", [m("a")])]))
m.render(root, m("ul", [{fromCache: true}]))
return root.childNodes[0].childNodes[0].childNodes[0].nodeName === "A"
})
//m.redraw
test(function() {