refactor redraw
This commit is contained in:
parent
0f5d051d4b
commit
7295b6e9e9
6 changed files with 26 additions and 9 deletions
|
|
@ -714,12 +714,13 @@ function testMithril(mock) {
|
|||
}
|
||||
})
|
||||
mock.requestAnimationFrame.$resolve() //teardown
|
||||
m.redraw()
|
||||
m.redraw()
|
||||
m.redraw() //should run synchronously
|
||||
|
||||
m.redraw() //rest should run asynchronously since they're spamming
|
||||
m.redraw()
|
||||
m.redraw()
|
||||
mock.requestAnimationFrame.$resolve() //teardown
|
||||
return count === 2
|
||||
return count === 3
|
||||
})
|
||||
|
||||
//m.route
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ mock.window = new function() {
|
|||
}
|
||||
window.scrollTo = function() {}
|
||||
window.cancelAnimationFrame = function() {}
|
||||
window.requestAnimationFrame = function(callback) {window.requestAnimationFrame.$callback = callback}
|
||||
window.requestAnimationFrame = function(callback) {
|
||||
window.requestAnimationFrame.$callback = callback
|
||||
return window.requestAnimationFrame.$id++
|
||||
}
|
||||
window.requestAnimationFrame.$id = 1
|
||||
window.requestAnimationFrame.$resolve = function() {
|
||||
if (window.requestAnimationFrame.$callback) window.requestAnimationFrame.$callback()
|
||||
window.requestAnimationFrame.$callback = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue