Add editorconfig, resolve differences
This includes newlines, tabs, among other things.
This commit is contained in:
parent
80d0a69dab
commit
b4fb21475c
90 changed files with 1707 additions and 1701 deletions
|
|
@ -11,74 +11,74 @@ o.spec("throttle", function() {
|
|||
spy = o.spy()
|
||||
throttled = throttle(spy)
|
||||
})
|
||||
|
||||
|
||||
o("runs first call synchronously", function() {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("throttles subsequent synchronous calls", function(done) {
|
||||
throttled()
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET) //this delay is much higher than 16.6ms due to setTimeout clamp and other runtime costs
|
||||
})
|
||||
|
||||
|
||||
o("calls after threshold", function(done) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function(t) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
o("throttles before threshold", function(done) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
callAsync(function(t) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o("it only runs once per tick", function(done) {
|
||||
throttled()
|
||||
throttled()
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
|
||||
o("it supports forcing a synchronous redraw", function() {
|
||||
throttled()
|
||||
throttled()
|
||||
throttled(true)
|
||||
|
||||
|
||||
o(spy.callCount).equals(2)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue