Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb1eb3a

Browse files
committed
add jasmine test
1 parent ebbb2e1 commit bb1eb3a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/jasmine/tests/hover_label_test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4780,6 +4780,52 @@ describe('hover distance', function() {
47804780
});
47814781
});
47824782

4783+
describe('hover working with zorder', function() {
4784+
'use strict';
4785+
4786+
var mock = {
4787+
data: [{
4788+
zorder: 100,
4789+
marker: {size: 50},
4790+
text: ['A', 'B'],
4791+
y: [0, 1]
4792+
}, {
4793+
marker: {size: 50},
4794+
text: ['C', 'D'],
4795+
y: [2, 1]
4796+
}],
4797+
layout: {
4798+
width: 400,
4799+
height: 400,
4800+
showlegend: false,
4801+
hovermode: 'closest'
4802+
}
4803+
};
4804+
4805+
afterEach(destroyGraphDiv);
4806+
4807+
beforeEach(function(done) {
4808+
Plotly.newPlot(createGraphDiv(), mock).then(done);
4809+
});
4810+
4811+
it('pick the trace on top', function() {
4812+
var gd = document.getElementById('graph');
4813+
Fx.hover('graph', {xval: 1}, 'xy');
4814+
4815+
expect(gd._hoverdata.length).toEqual(1);
4816+
4817+
assertHoverLabelContent({
4818+
nums: '(1, 1)\nB',
4819+
name: 'trace 0'
4820+
});
4821+
4822+
var hoverTrace = gd._hoverdata[0];
4823+
expect(hoverTrace.text).toEqual('B');
4824+
expect(hoverTrace.curveNumber).toEqual(0);
4825+
expect(hoverTrace.pointNumber).toEqual(1);
4826+
});
4827+
});
4828+
47834829
describe('hover label rotation:', function() {
47844830
var gd;
47854831

0 commit comments

Comments
 (0)