Skip to content

Commit aa55b13

Browse files
committed
plotly#313 adding a test case for the 'plotly_hover' callback for the preexisting option "hoverinfo" : "none"
1 parent a3815f8 commit aa55b13

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/jasmine/tests/click_test.js

+32
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,38 @@ describe('click interactions', function() {
102102
});
103103
});
104104

105+
describe('click events with hoverinfo set to none', function() {
106+
var futureData;
107+
108+
beforeEach(function(done) {
109+
gd = createGraphDiv();
110+
111+
var mockCopy = Lib.extendDeep({}, mock);
112+
mockCopy.data[0].hoverinfo = 'none';
113+
Plotly.plot(gd, mockCopy.data, mockCopy.layout)
114+
.then(done);
115+
116+
gd.on('plotly_hover', function(data) {
117+
futureData = data;
118+
});
119+
});
120+
121+
it('should contain the correct fields despite hoverinfo: "none"', function() {
122+
click(pointPos[0], pointPos[1]);
123+
expect(futureData.points.length).toEqual(1);
124+
125+
var pt = futureData.points[0];
126+
expect(Object.keys(pt)).toEqual([
127+
'data', 'fullData', 'curveNumber', 'pointNumber',
128+
'x', 'y', 'xaxis', 'yaxis'
129+
]);
130+
expect(pt.curveNumber).toEqual(0);
131+
expect(pt.pointNumber).toEqual(11);
132+
expect(pt.x).toEqual(0.125);
133+
expect(pt.y).toEqual(2.125);
134+
});
135+
});
136+
105137
describe('double click events', function() {
106138
var futureData;
107139

0 commit comments

Comments
 (0)