allow string keys
This commit is contained in:
parent
5003c0ac23
commit
3de5cb8aaf
2 changed files with 37 additions and 3 deletions
|
|
@ -269,6 +269,41 @@ function testMithril(mock) {
|
|||
|
||||
return firstBefore === firstAfter
|
||||
})
|
||||
test(function() {
|
||||
//string keys in components should work
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
var list = [1, 2, 3]
|
||||
var component = {
|
||||
controller: function() {},
|
||||
view: function() {
|
||||
return list.map(function(i) {
|
||||
return m.component(sub, {key: "key" + i})
|
||||
})
|
||||
}
|
||||
}
|
||||
var sub = {
|
||||
controller: function() {},
|
||||
view: function() {
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
m.mount(root, component)
|
||||
|
||||
var firstBefore = root.childNodes[0]
|
||||
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
list.reverse()
|
||||
m.redraw(true)
|
||||
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
var firstAfter = root.childNodes[2]
|
||||
|
||||
return firstBefore === firstAfter
|
||||
})
|
||||
test(function() {
|
||||
//keys in subcomponents should work
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue