add test for #523

This commit is contained in:
Leo Horie 2015-03-30 14:53:03 -04:00
parent 80437a0f23
commit 1d0aa035c6

View file

@ -68,7 +68,6 @@ function testMithril(mock) {
return root.childNodes.length
})
test(function() {
mock.requestAnimationFrame.$resolve()
@ -947,6 +946,43 @@ function testMithril(mock) {
return root.childNodes.length == 3
})
test(function() {
var root = mock.document.createElement("div")
var show = true
var testcomponent = {
controller: function() {},
view: function() {
return m('div', 'component');
}
};
var app = {
view: function(scope) {
return show ? [
m('h1', '1'),
testcomponent
] : [
m('h1', '2'),
];
}
};
m.module(root, app);
mock.requestAnimationFrame.$resolve()
show = false
m.redraw()
mock.requestAnimationFrame.$resolve()
show = true
m.redraw()
mock.requestAnimationFrame.$resolve()
return root.childNodes.length == 2
})
m.redraw.strategy(undefined) //teardown for m.module tests
//m.withAttr