Skip to content

Commit be2b523

Browse files
committed
🔪 hover test in finance_test - hover_label_test covers it better
1 parent 2849ff9 commit be2b523

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

test/jasmine/tests/finance_test.js

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -426,69 +426,6 @@ describe('finance charts calc', function() {
426426
expect(mapGet(out[1], 'dir')).toEqual(directions);
427427
});
428428

429-
['ohlc', 'candlestick'].forEach(function(type) {
430-
it('generates correct hover text for ' + type, function() {
431-
var trace0 = Lib.extendDeep({}, mock0, {
432-
type: type,
433-
text: ['A', 'B', 'C', 'D']
434-
});
435-
436-
var trace1 = Lib.extendDeep({}, mock1, {
437-
type: type,
438-
text: 'IMPORTANT',
439-
hoverinfo: 'x+text',
440-
xaxis: 'x2'
441-
});
442-
443-
var gd = _calcGd([trace0, trace1]);
444-
var calcdata = gd.calcdata;
445-
var tracesOut = calcdata.map(calcDatatoTrace);
446-
447-
var _hover = tracesOut[0]._module.hoverPoints;
448-
function hoverOn(curveNum, x, y) {
449-
var pointData = {
450-
cd: calcdata[curveNum],
451-
xa: gd._fullLayout[tracesOut[curveNum].xaxis === 'x2' ? 'xaxis2' : 'xaxis'],
452-
ya: gd._fullLayout.yaxis,
453-
maxHoverDistance: 20,
454-
maxSpikeDistance: 20,
455-
distance: Infinity,
456-
spikeDistance: Infinity,
457-
index: false
458-
};
459-
460-
var pts = _hover(pointData, x, y, 'closest');
461-
return pts[0];
462-
}
463-
464-
expect(tracesOut[0].hoverinfo).toBe('all');
465-
expect(mapGet(calcdata[0], 'tx')).toEqual([
466-
'A', 'B', 'C', 'D', undefined, undefined, undefined, undefined
467-
]);
468-
expect(hoverOn(0, 0, 33)).toEqual(jasmine.objectContaining({
469-
text: 'open: 33.01<br>high: 34.2<br>low: 31.7<br>close: 34.1<br>A',
470-
color: tracesOut[0].increasing.line.color
471-
}));
472-
expect(hoverOn(0, 1, 33)).toEqual(jasmine.objectContaining({
473-
text: 'open: 33.31<br>high: 34.37<br>low: 30.75<br>close: 31.93<br>B',
474-
color: tracesOut[0].decreasing.line.color
475-
}));
476-
477-
expect(tracesOut[1].hoverinfo).toBe('x+text');
478-
expect(mapGet(calcdata[1], 'tx')).toEqual([
479-
undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined
480-
]);
481-
expect(hoverOn(1, calcdata[1][0].pos, 33)).toEqual(jasmine.objectContaining({
482-
text: 'open: 33.01<br>high: 34.2<br>low: 31.7<br>close: 34.1<br>IMPORTANT',
483-
color: tracesOut[1].increasing.line.color
484-
}));
485-
expect(hoverOn(1, calcdata[1][1].pos, 33)).toEqual(jasmine.objectContaining({
486-
text: 'open: 33.31<br>high: 34.37<br>low: 30.75<br>close: 31.93<br>IMPORTANT',
487-
color: tracesOut[1].decreasing.line.color
488-
}));
489-
});
490-
});
491-
492429
it('should work with *filter* transforms', function() {
493430
var trace0 = Lib.extendDeep({}, mock1, {
494431
type: 'ohlc',

0 commit comments

Comments
 (0)