From e24adca8ef554541d122402377347372e7df0154 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Fri, 1 Apr 2016 15:57:42 +0200 Subject: [PATCH 1/8] #313 populate searchdata even if hoverinfo === 'none', because otherwise hoverinfo will be undefined --- src/plots/cartesian/graph_interact.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plots/cartesian/graph_interact.js b/src/plots/cartesian/graph_interact.js index 1a13c920c5d..2a777bc9032 100644 --- a/src/plots/cartesian/graph_interact.js +++ b/src/plots/cartesian/graph_interact.js @@ -368,14 +368,14 @@ function hover(gd, evt, subplot) { hovermode = 'array'; for(itemnum = 0; itemnum Date: Wed, 13 Apr 2016 12:48:03 +0200 Subject: [PATCH 2/8] #313 adding a test case for preexisting option "hoverinfo" : "none" --- test/jasmine/tests/hover_label_test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 37e3c7b27b6..29cef75bfe8 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -244,6 +244,31 @@ describe('hover info', function() { }); }); + describe('hover info none', function() { + var mockCopy = Lib.extendDeep({}, mock); + + mockCopy.data[0].hoverinfo = 'none'; + + beforeEach(function(done) { + Plotly.plot(createGraphDiv(), mockCopy.data, mockCopy.layout).then(done); + }); + + it('does not render if hover is set to none', function() { + var gd = document.getElementById('graph'); + Fx.hover('graph', evt, 'xy'); + + var hoverTrace = gd._hoverdata[0]; + + expect(hoverTrace.curveNumber).toEqual(0); + expect(hoverTrace.pointNumber).toEqual(17); + expect(hoverTrace.x).toEqual(0.388); + expect(hoverTrace.y).toEqual(1); + + expect(d3.selectAll('g.axistext').size()).toEqual(0); + expect(d3.selectAll('g.hovertext').size()).toEqual(0); + }); + }); + describe('hoverformat', function() { var data = [{ From 6d508d0237fb3dbc86d8833064bd58e57369606e Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Wed, 13 Apr 2016 13:38:00 +0200 Subject: [PATCH 3/8] #313 test heisenbug solution --- test/jasmine/tests/gl_plot_interact_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 92607cf5d42..6e9abed3e7e 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -17,7 +17,7 @@ var customMatchers = require('../assets/custom_matchers'); */ var PLOT_DELAY = 200; -var MOUSE_DELAY = 20; +var MOUSE_DELAY = 40; var MODEBAR_DELAY = 500; From eaf1758eba6731b07e313a59b029f381a133d380 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Wed, 13 Apr 2016 14:42:16 +0200 Subject: [PATCH 4/8] #313 add test to check the preservation of the hover info even if hoverinfo is set to none --- test/jasmine/tests/click_test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index 28227a14ce9..bc7653d6524 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -70,6 +70,38 @@ describe('click interactions', function() { }); }); + describe('click events with hoverinfo set to none', function() { + var futureData; + + beforeEach(function(done) { + gd = createGraphDiv(); + + var mockCopy = Lib.extendDeep({}, mock); + mockCopy.data[0].hoverinfo = 'none'; + Plotly.plot(gd, mockCopy.data, mockCopy.layout) + .then(done); + + gd.on('plotly_click', function(data) { + futureData = data; + }); + }); + + it('should contain the correct fields despite hoverinfo: "none"', function() { + click(pointPos[0], pointPos[1]); + expect(futureData.points.length).toEqual(1); + + var pt = futureData.points[0]; + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', + 'x', 'y', 'xaxis', 'yaxis' + ]); + expect(pt.curveNumber).toEqual(0); + expect(pt.pointNumber).toEqual(11); + expect(pt.x).toEqual(0.125); + expect(pt.y).toEqual(2.125); + }); + }); + describe('double click events', function() { var futureData; From a04592765cf524f69574d476aff5acb461addb74 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Thu, 14 Apr 2016 12:19:39 +0200 Subject: [PATCH 5/8] #313 add currently failing test to check the preservation of the hover info even if hovermode is set to false --- test/jasmine/tests/click_test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index bc7653d6524..0fd2d8b879e 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -102,6 +102,38 @@ describe('click interactions', function() { }); }); + describe('click events with hovermode set to false', function() { + var futureData; + + beforeEach(function(done) { + gd = createGraphDiv(); + + var mockCopy = Lib.extendDeep({}, mock); + Plotly.plot(gd, mockCopy.data, Lib.extendDeep({}, mockCopy.layout, {hovermode: false})) + .then(done); + + gd.on('plotly_click', function(data) { + futureData = data; + }); + }); + + it('should contain the correct fields despite hovermode: false', function() { + click(pointPos[0], pointPos[1]); + expect(futureData.points.length).toEqual(1); + + var pt = futureData.points[0]; + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', + 'x', 'y', 'xaxis', 'yaxis' + ]); + expect(pt.curveNumber).toEqual(0); + expect(pt.pointNumber).toEqual(11); + expect(pt.x).toEqual(0.125); + expect(pt.y).toEqual(2.125); + + }); + }); + describe('double click events', function() { var futureData; From cb14283c6f37bfe3c3a42f83425b761ad2e31894 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Thu, 14 Apr 2016 12:28:28 +0200 Subject: [PATCH 6/8] #313 test heisenbug solution - increase wait time as 40ms still wasn't enough sometimes --- test/jasmine/tests/gl_plot_interact_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 6e9abed3e7e..91eb063594a 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -17,7 +17,7 @@ var customMatchers = require('../assets/custom_matchers'); */ var PLOT_DELAY = 200; -var MOUSE_DELAY = 40; +var MOUSE_DELAY = 60; var MODEBAR_DELAY = 500; From a3815f85731d9fff1a7ac6225a8420b5159999a4 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Sat, 16 Apr 2016 15:43:18 +0200 Subject: [PATCH 7/8] Revert "#313 add currently failing test to check the preservation of the hover info even if hovermode is set to false" This reverts commit a04592765cf524f69574d476aff5acb461addb74. --- test/jasmine/tests/click_test.js | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index 0fd2d8b879e..bc7653d6524 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -102,38 +102,6 @@ describe('click interactions', function() { }); }); - describe('click events with hovermode set to false', function() { - var futureData; - - beforeEach(function(done) { - gd = createGraphDiv(); - - var mockCopy = Lib.extendDeep({}, mock); - Plotly.plot(gd, mockCopy.data, Lib.extendDeep({}, mockCopy.layout, {hovermode: false})) - .then(done); - - gd.on('plotly_click', function(data) { - futureData = data; - }); - }); - - it('should contain the correct fields despite hovermode: false', function() { - click(pointPos[0], pointPos[1]); - expect(futureData.points.length).toEqual(1); - - var pt = futureData.points[0]; - expect(Object.keys(pt)).toEqual([ - 'data', 'fullData', 'curveNumber', 'pointNumber', - 'x', 'y', 'xaxis', 'yaxis' - ]); - expect(pt.curveNumber).toEqual(0); - expect(pt.pointNumber).toEqual(11); - expect(pt.x).toEqual(0.125); - expect(pt.y).toEqual(2.125); - - }); - }); - describe('double click events', function() { var futureData; From aa55b138f1255c20ee110233be62d96d0309a53c Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Sun, 17 Apr 2016 11:17:25 +0200 Subject: [PATCH 8/8] #313 adding a test case for the 'plotly_hover' callback for the preexisting option "hoverinfo" : "none" --- test/jasmine/tests/click_test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index bc7653d6524..b249aa92f3d 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -102,6 +102,38 @@ describe('click interactions', function() { }); }); + describe('click events with hoverinfo set to none', function() { + var futureData; + + beforeEach(function(done) { + gd = createGraphDiv(); + + var mockCopy = Lib.extendDeep({}, mock); + mockCopy.data[0].hoverinfo = 'none'; + Plotly.plot(gd, mockCopy.data, mockCopy.layout) + .then(done); + + gd.on('plotly_hover', function(data) { + futureData = data; + }); + }); + + it('should contain the correct fields despite hoverinfo: "none"', function() { + click(pointPos[0], pointPos[1]); + expect(futureData.points.length).toEqual(1); + + var pt = futureData.points[0]; + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', + 'x', 'y', 'xaxis', 'yaxis' + ]); + expect(pt.curveNumber).toEqual(0); + expect(pt.pointNumber).toEqual(11); + expect(pt.x).toEqual(0.125); + expect(pt.y).toEqual(2.125); + }); + }); + describe('double click events', function() { var futureData;