I am using jasmine
to unit test some interactions in a d3.js
chart. I have been using d3.timerFlush()
to complete the executions of anima
Alright, figured it out, d3
version 3 used to use date.now
to measure time. Version 4 moved to performance.now.
So, the correct code should be:
it('it will remove all of the pie related elements from the DOM', () => {
chartSvc.exit();
performance.now = function() { return Infinity; };
d3.timerFlush();
let elements = svg.querySelectorAll(/* selects my elements */);
expect(elements.length).toEqual(0);
});
Here's some test code: