D3 Treemap diagram fails test#12

Failing most of the time (sometime it passes) for the test case #12. That’s really strange, as I have tried also the .toFixed(2) method, however nothing helped, can’t figure out the problem.

link to my code sandbox:
My Treemap diagram project

It intermittently raises the tooltips on normal mouse usage, so that explains why the test occasionally passes (it’s also failing #11, but I believe it’s the same problem). Usually the tests seem to have problems with transitions, most of which are resolved by setting the time to zero or removing them. I believe that the tests are missing your tooltips because they expect them to appear immediately, not after a transition time.

I would also consider adding the mouseenter and mouseleave events as well so that the tooltip is activated immediately upon entry or exit.

The values look correct, but if you are worried about them, just console.log() them in your tooltip function to ensure they are correct.

1 Like