From b24906eafeb3efdd556e0fe1b95f2c5a6759600d Mon Sep 17 00:00:00 2001 From: Ricky Reusser Date: Wed, 21 Jun 2017 16:59:04 -0700 Subject: [PATCH 1/4] Fix hover error in appendArrayPointValue --- src/components/fx/helpers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/fx/helpers.js b/src/components/fx/helpers.js index a2b5580d026..0f6b0aa52d4 100644 --- a/src/components/fx/helpers.js +++ b/src/components/fx/helpers.js @@ -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; From 64a87f95bc3fa5ba332048527120b3a39da024fd Mon Sep 17 00:00:00 2001 From: Ricky Reusser Date: Mon, 26 Jun 2017 10:58:14 -0400 Subject: [PATCH 2/4] test ohlc + hover --- test/jasmine/tests/hover_label_test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 72dee431d46..e20fe6290d5 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -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] + }]; + + 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); + }); +}); From 4b6fe4e4af3a9fd168413c612ab8475a61f57379 Mon Sep 17 00:00:00 2001 From: Ricky Reusser Date: Mon, 26 Jun 2017 11:25:54 -0400 Subject: [PATCH 3/4] Fix hover label test --- test/jasmine/tests/hover_label_test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index e20fe6290d5..c1f4fb0c25f 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -1303,12 +1303,11 @@ describe('Test hover label custom styling:', function() { 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], - x: [1, 2, 3], - y: [0.12345, 0.23456, 0.34567] }]; beforeEach(function() { From 96767d8ea72f8077e94050ba64570b294624c51d Mon Sep 17 00:00:00 2001 From: Ricky Reusser Date: Mon, 26 Jun 2017 11:28:08 -0400 Subject: [PATCH 4/4] Add assertion to test --- test/jasmine/tests/hover_label_test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index c1f4fb0c25f..5498d69aff1 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -1320,5 +1320,7 @@ describe('ohlc hover interactions', function() { it('should not fail in appendArrayPointValue', function() { Plotly.plot(this.gd, data); mouseEvent('mousemove', 203, 213); + + expect(d3.select('.hovertext').size()).toBe(1); }); });