add test for #523
This commit is contained in:
parent
80437a0f23
commit
1d0aa035c6
1 changed files with 37 additions and 1 deletions
|
|
@ -68,7 +68,6 @@ function testMithril(mock) {
|
||||||
|
|
||||||
return root.childNodes.length
|
return root.childNodes.length
|
||||||
})
|
})
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
mock.requestAnimationFrame.$resolve()
|
mock.requestAnimationFrame.$resolve()
|
||||||
|
|
||||||
|
|
@ -947,6 +946,43 @@ function testMithril(mock) {
|
||||||
|
|
||||||
return root.childNodes.length == 3
|
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.redraw.strategy(undefined) //teardown for m.module tests
|
||||||
|
|
||||||
//m.withAttr
|
//m.withAttr
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue