I have an chart built by d3
and which appears with transitions and I need to test chart when all transitions have ended. I use jasmine
for unit-testing. How to do it?
I find method d3.timer.flush()
, but it skips only first frame, but I want to skip all animations and see an final result right now and make some assertions on it.
相关问题
- Dependencies while implementing Mocking in Junit4
- Highlight parent path to the root
- Avoid overlapping of nodes in tree layout in d3.js
- How to unit test a reactive component where ngCont
- d3.js moving average with previous and next data v
相关文章
- How to replace file-access references for a module
- How to mock methods return object with deleted cop
- What is a good way of cleaning up after a unit tes
-
EF6 DbSet
returns null in Moq - React testing library: Test attribute / prop
- React/JestJS/Enzyme: How to test for ref function?
- Keep constant number of visible circles in 3D anim
- D3.js: Stop transitions interrupting on mouseover?
You can execute transitions synchronously directly to their final state with one call to D3's timer flush if you mock out its timestamp determination during the flush like so:
An alternative to mocking out transitions is executing them synchronously directly to their final state.
With D3.js v4, do:
With D3.js v3 and previous, do:
Mocking the transition altogether (to avoid the calculation overhead) yielded mixed results for me, for example if your final state is created with an
attrTween
, it needs to be executed.See also our discussion in d3 issue 1789 and SO 14443724.