#466 allow modules as second parameter of m
This commit is contained in:
parent
971b0def51
commit
c81294bce8
2 changed files with 40 additions and 3 deletions
|
|
@ -424,7 +424,44 @@ function testMithril(mock) {
|
|||
|
||||
return loaded === false
|
||||
})
|
||||
test(function() {
|
||||
// nested modules under keyed components should render
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
var count = 0
|
||||
var App = {
|
||||
controller: function() {},
|
||||
view: function(ctrl) {
|
||||
return m('.outer', [
|
||||
m('.inner', m.module(CommentList, { list: [1, 2, 3] }))
|
||||
])
|
||||
}
|
||||
}
|
||||
var CommentList = {
|
||||
controller: function() {},
|
||||
view: function(ctrl, props) {
|
||||
return m('.list', props.list.map(function(i) {
|
||||
return m('.comment', [
|
||||
m.module(Reply, {key: i})
|
||||
])
|
||||
}))
|
||||
}
|
||||
}
|
||||
var Reply = {
|
||||
controller: function() {},
|
||||
view: function() {
|
||||
count++
|
||||
return m(".reply")
|
||||
}
|
||||
}
|
||||
m.module(root, App)
|
||||
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
return count === 3
|
||||
})
|
||||
|
||||
//m.withAttr
|
||||
test(function() {
|
||||
var value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue