Skip to content

Fix for number 0 treated as invalid in hover#1

Merged
dalle merged 2 commits into
masterfrom
fix-hover-treat-zero-as-valid
May 30, 2018
Merged

Fix for number 0 treated as invalid in hover#1
dalle merged 2 commits into
masterfrom
fix-hover-treat-zero-as-valid

Conversation

@dalle
Copy link
Copy Markdown
Owner

@dalle dalle commented May 29, 2018

Fixes plotly#2660.

Comment thread test/jasmine/tests/hover_label_test.js Outdated
expect(hoverTrace.pointNumber).toEqual(17);
expect(hoverTrace.x).toEqual(0.388);
expect(hoverTrace.y).toEqual(1);
expect(hoverTrace.text).toEqual(0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're faithfully mimicking the previous test, but I'd prefer toBe instead of toEqual - lately I use toBe whenever possible, which I think includes all of these cases - especially for the 0, since some values we would find unacceptable would pass, like '' == 0, whereas toBe is stricter.

@alexcjohnson
Copy link
Copy Markdown

@dalle this looks great! Just a small comment, then feel free to open the PR against the main repo. Thanks!

@dalle dalle merged commit 1113e33 into master May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants