Skip to content

Fix closest hover and click+select with zorder #6953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add jasmine test
  • Loading branch information
archmoj committed Apr 10, 2024
commit bb1eb3a7c720b1453f379b683bd2ea8d73005e9c
46 changes: 46 additions & 0 deletions test/jasmine/tests/hover_label_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4780,6 +4780,52 @@ describe('hover distance', function() {
});
});

describe('hover working with zorder', function() {
'use strict';

var mock = {
data: [{
zorder: 100,
marker: {size: 50},
text: ['A', 'B'],
y: [0, 1]
}, {
marker: {size: 50},
text: ['C', 'D'],
y: [2, 1]
}],
layout: {
width: 400,
height: 400,
showlegend: false,
hovermode: 'closest'
}
};

afterEach(destroyGraphDiv);

beforeEach(function(done) {
Plotly.newPlot(createGraphDiv(), mock).then(done);
});

it('pick the trace on top', function() {
var gd = document.getElementById('graph');
Fx.hover('graph', {xval: 1}, 'xy');

expect(gd._hoverdata.length).toEqual(1);

assertHoverLabelContent({
nums: '(1, 1)\nB',
name: 'trace 0'
});

var hoverTrace = gd._hoverdata[0];
expect(hoverTrace.text).toEqual('B');
expect(hoverTrace.curveNumber).toEqual(0);
expect(hoverTrace.pointNumber).toEqual(1);
});
});

describe('hover label rotation:', function() {
var gd;

Expand Down