Skip to content

Commit eaf1758

Browse files
committed
plotly#313 add test to check the preservation of the hover info even if hoverinfo is set to none
1 parent 6d508d0 commit eaf1758

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/jasmine/tests/click_test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ describe('click interactions', function() {
7070
});
7171
});
7272

73+
describe('click events with hoverinfo set to none', function() {
74+
var futureData;
75+
76+
beforeEach(function(done) {
77+
gd = createGraphDiv();
78+
79+
var mockCopy = Lib.extendDeep({}, mock);
80+
mockCopy.data[0].hoverinfo = 'none';
81+
Plotly.plot(gd, mockCopy.data, mockCopy.layout)
82+
.then(done);
83+
84+
gd.on('plotly_click', function(data) {
85+
futureData = data;
86+
});
87+
});
88+
89+
it('should contain the correct fields despite hoverinfo: "none"', function() {
90+
click(pointPos[0], pointPos[1]);
91+
expect(futureData.points.length).toEqual(1);
92+
93+
var pt = futureData.points[0];
94+
expect(Object.keys(pt)).toEqual([
95+
'data', 'fullData', 'curveNumber', 'pointNumber',
96+
'x', 'y', 'xaxis', 'yaxis'
97+
]);
98+
expect(pt.curveNumber).toEqual(0);
99+
expect(pt.pointNumber).toEqual(11);
100+
expect(pt.x).toEqual(0.125);
101+
expect(pt.y).toEqual(2.125);
102+
});
103+
});
104+
73105
describe('double click events', function() {
74106
var futureData;
75107

0 commit comments

Comments
 (0)