Add m.redraw() support for multiple mount points
To better match `0.2.x` behavior: https://jsfiddle.net/xbpyqL9k/
This commit is contained in:
parent
058b25002d
commit
71c77ba603
8 changed files with 97 additions and 30 deletions
55
api/tests/test-redraw.js
Normal file
55
api/tests/test-redraw.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var createRedraw = require("../../api/redraw")
|
||||
|
||||
o.spec("m.redraw", function() {
|
||||
var redraw, renderers
|
||||
|
||||
o.beforeEach(function() {
|
||||
renderers = []
|
||||
redraw = createRedraw(renderers)
|
||||
})
|
||||
|
||||
o("it shouldn't error if there are no renderers", function() {
|
||||
redraw()
|
||||
})
|
||||
|
||||
o("it should run a single renderer entry", function() {
|
||||
var spy = o.spy()
|
||||
|
||||
renderers.push(spy)
|
||||
|
||||
redraw()
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
redraw()
|
||||
redraw()
|
||||
redraw()
|
||||
|
||||
o(spy.callCount).equals(4)
|
||||
})
|
||||
|
||||
o("it should run all renderer entries", function() {
|
||||
var spy1 = o.spy()
|
||||
var spy2 = o.spy()
|
||||
var spy3 = o.spy()
|
||||
|
||||
renderers.push(spy1, spy2, spy3)
|
||||
|
||||
redraw()
|
||||
|
||||
o(spy1.callCount).equals(1)
|
||||
o(spy2.callCount).equals(1)
|
||||
o(spy3.callCount).equals(1)
|
||||
|
||||
redraw()
|
||||
redraw()
|
||||
redraw()
|
||||
|
||||
o(spy1.callCount).equals(4)
|
||||
o(spy2.callCount).equals(4)
|
||||
o(spy3.callCount).equals(4)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue