Skip to content

Fix hover error in appendArrayPointValue #1808

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

Merged
merged 4 commits into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/fx/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ function quadrature(dx, dy) {
exports.appendArrayPointValue = function(pointData, trace, pointNumber) {
var arrayAttrs = trace._arrayAttrs;

if(!arrayAttrs) {
return;
}

for(var i = 0; i < arrayAttrs.length; i++) {
var astr = arrayAttrs[i];
var key;
Expand Down
25 changes: 25 additions & 0 deletions test/jasmine/tests/hover_label_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,3 +1299,28 @@ describe('Test hover label custom styling:', function() {
.then(done);
});
});

describe('ohlc hover interactions', function() {
var data = [{
type: 'candlestick',
x: ['2011-01-01', '2012-01-01'],
open: [2, 2],
high: [3, 3],
low: [0, 0],
close: [3, 3],
}];

beforeEach(function() {
this.gd = createGraphDiv();
});

afterEach(destroyGraphDiv);

// 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 ✅


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