Disabling all D3 animations (for testing)

前端 未结 4 1512
旧巷少年郎
旧巷少年郎 2020-12-30 00:36

I\'m looking for a D3 equivalent to jQuery.fx.off = true.

Say you are writing tests (with Mocha, QUnit, etc.) for an app that uses D3. The app has some D3 animations

4条回答
  •  甜味超标
    2020-12-30 00:46

    One approach you could take is to use a fake timer in your testing suite, like Sinon, which works with Mocha or QUnit. Jasmine also has a mock timer built in. I'd think this a better approach because it means the code you're testing is closer to the running code (as opposed to sabotaging the transition functions).

提交回复
热议问题