Allow mocking of 'requestAnimationFrame' #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, this is quite a minor change -- I'm fine if you don't take it.
However, we've found (in Power BI visual development) that mocking
requestAnimationFrame()
allows us to "speed" through d3.transitions() in our unit tests. We've made this change locally for our d3's distribution, I thought it might be useful to share here.We use jasmine's clock to tick forward in time. We also use a "Scheduler" class to mock RAF to execute immediately, so we also make this change in the d3 source. Again, this is a "testability"-only change that may be useful to others mocking time in unit tests :)