Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hover error in appendArrayPointValue #1808

Merged
merged 4 commits into from
Jun 26, 2017
Merged

Conversation

rreusser
Copy link
Contributor

@rreusser rreusser commented Jun 22, 2017

This PR address the issue in #1807 by exiting early if arrayAttrs is undefined. This may or may not be an appropriate fix. I could test this by passing it a plain object with no _arrayAttrs, but it seems to be of questionable value since appendArrayPointValue isn't tested otherwise. Can add, but I'll wait for a second opinion on the source of the problem.

@etpinard
Copy link
Contributor

I don't see the need to test appendArrayPointValue im isolation. We should instead test "real" hover by mocking mouse events or Fx.hover.

Moreover, I think it would be best to make _arrayAttrs be always defined for every trace type. When no array attributes are present, arrayAttrs should be []

@etpinard
Copy link
Contributor

@rreusser have you tried adding any tests for this?

@rreusser
Copy link
Contributor Author

@etpinard Yup. Pushing.

@rreusser
Copy link
Contributor Author

I added it to the hover_label_test since it seems loosely related to hover data, but let me know if there's a better place for it.

low: [0, 0],
close: [3, 3],
x: [1, 2, 3],
y: [0.12345, 0.23456, 0.34567]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Does y do anything for ohlc? This looks like somehow leftover from another test, though it does trigger and respond to the fixed bug correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

y isn't a valid attribute. 🔪

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🔪 'd

// See: https://github.com/plotly/plotly.js/issues/1807
it('should not fail in appendArrayPointValue', function() {
Plotly.plot(this.gd, data);
mouseEvent('mousemove', 203, 213);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe assert that the hover label is showing e.g. by

expect(d3.select('.hovertext').size()).toBe(1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Added ✅

@etpinard
Copy link
Contributor

💃 not a perfect solution (see #1807 (comment)) but good enough for now and, more importantly, good enough for 1.28.3

@rreusser rreusser merged commit 09181b1 into master Jun 26, 2017
@rreusser rreusser deleted the fix-append-array-point-value branch June 26, 2017 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants