Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
24 changes: 24 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,27 @@ describe('Test hover label custom styling:', function() {
.then(done);
});
});

describe('ohlc hover interactions', function() {
var data = [{
type: 'candlestick',
open: [2, 2],
high: [3, 3],
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

}];

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 ✅

});
});