Last test not passing - D3: Bar Chart

Any insight on why is the last test on D3: Bar Chart not passing?

Tooltip’s “data-date” property should be equal to the active area’s “data-date” property: expected ‘2015-07-01’ to equal ‘1956-04-01’

If you hover over, you can see the correct year and quarter. I guess it has something to do with line 78 in the pen.

https://codepen.io/gerardcsaperas/pen/xxwvLGb?editors=0110

Thank you!

Line 78 adds a test attribute on each rect bar, which is something that is not required at all.

What the test is saying that you need to add data-date attribute on the tooltip element. And since it is on tooltip, this attribute should be updated on hover as well.

So, you’ll need to do something like this tooltip.attr("data-date", d[0]) in your mouseover function it seems like.

1 Like

Thank you for your feedback! The “test” was just a name for the attribute, which calls a function that added exactly tooltip.attr("data-date", d[0]).

I put it inside the mouseover and now it’s working!