Closed seanpoulter closed 5 years ago
This should fix those tests @buzzdecafe and close #56.
Heads up, I accidentally created the PR before finishing my notes. Take a look on GitHub if your notification email didn't make sense. 😉
wow that's all there was too it? Very nice catch, @seanpoulter . I wanna verify on my local tonight, then will merge. Thanks. (sinon often feels a bit too magical for me.)
As reported in #55, two tests have been failing when running locally. Investigation has shown that the
change
event handler inbindInputPanel
is not called. Despite the tests waiting twice the debouncing delay, the debounced function is not called.The root cause of the test failures is the fake timers are not applying to the
now()
call in thedebounce
library. Based on the docs for fake timers, callingsinon.useFakeTimers()
should:After calling
clock.tick(ms)
we should seems
, but instead we get the currenttimestamp
(below highlighted variable on mid left):Changing the order of the imports ensures that
debounce
anddate-now
use the fake timers, and the tests pass. With the changes in this PR, notice how thetimestamp
is our value forclock.tick(ms)
:Those failing tests pass: