Skip to content

Commit 567edde

Browse files
committed
test to 🔒 z-position of hover labels with respect to the modebar
1 parent 3e9d162 commit 567edde

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/plot_api/plot_api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3802,7 +3802,7 @@ function makePlotFramework(gd) {
38023802
.classed('gl-container', true);
38033803

38043804
fullLayout._paperdiv.selectAll('.main-svg').remove();
3805-
fullLayout._paperdiv.selectAll('.modebar-container').remove();
3805+
fullLayout._paperdiv.select('.modebar-container').remove();
38063806

38073807
fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child')
38083808
.classed('main-svg', true);

test/jasmine/tests/hover_label_test.js

+30
Original file line numberDiff line numberDiff line change
@@ -3221,6 +3221,36 @@ describe('hovermode defaults to', function() {
32213221
});
32223222
});
32233223

3224+
describe('hover labels z-position', function() {
3225+
var gd;
3226+
3227+
beforeEach(function() {
3228+
gd = createGraphDiv();
3229+
});
3230+
3231+
afterEach(destroyGraphDiv);
3232+
var mock = require('@mocks/14.json');
3233+
3234+
it('is above the modebar', function(done) {
3235+
Plotly.plot(gd, mock).then(function() {
3236+
var infolayer = document.getElementsByClassName('infolayer');
3237+
var modebar = document.getElementsByClassName('modebar-container');
3238+
var hoverlayer = document.getElementsByClassName('hoverlayer');
3239+
3240+
expect(infolayer.length).toBe(1);
3241+
expect(modebar.length).toBe(1);
3242+
expect(hoverlayer.length).toBe(1);
3243+
3244+
var compareMask = infolayer[0].compareDocumentPosition(modebar[0]);
3245+
expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.modebar-container appears after the .infolayer');
3246+
3247+
compareMask = modebar[0].compareDocumentPosition(hoverlayer[0]);
3248+
expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.hoverlayer appears after the .modebar');
3249+
})
3250+
.catch(failTest)
3251+
.then(done);
3252+
});
3253+
});
32243254

32253255
describe('touch devices', function() {
32263256
afterEach(destroyGraphDiv);

0 commit comments

Comments
 (0)