Skip to content

Commit

Permalink
test to 🔒 z-position of hover labels with respect to the modebar
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerg committed Mar 25, 2019
1 parent 3e9d162 commit 567edde
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3802,7 +3802,7 @@ function makePlotFramework(gd) {
.classed('gl-container', true);

fullLayout._paperdiv.selectAll('.main-svg').remove();
fullLayout._paperdiv.selectAll('.modebar-container').remove();
fullLayout._paperdiv.select('.modebar-container').remove();

fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child')
.classed('main-svg', true);
Expand Down
30 changes: 30 additions & 0 deletions test/jasmine/tests/hover_label_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3221,6 +3221,36 @@ describe('hovermode defaults to', function() {
});
});

describe('hover labels z-position', function() {
var gd;

beforeEach(function() {
gd = createGraphDiv();
});

afterEach(destroyGraphDiv);
var mock = require('@mocks/14.json');

it('is above the modebar', function(done) {
Plotly.plot(gd, mock).then(function() {
var infolayer = document.getElementsByClassName('infolayer');
var modebar = document.getElementsByClassName('modebar-container');
var hoverlayer = document.getElementsByClassName('hoverlayer');

expect(infolayer.length).toBe(1);
expect(modebar.length).toBe(1);
expect(hoverlayer.length).toBe(1);

var compareMask = infolayer[0].compareDocumentPosition(modebar[0]);
expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.modebar-container appears after the .infolayer');

compareMask = modebar[0].compareDocumentPosition(hoverlayer[0]);
expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.hoverlayer appears after the .modebar');
})
.catch(failTest)
.then(done);
});
});

describe('touch devices', function() {
afterEach(destroyGraphDiv);
Expand Down

0 comments on commit 567edde

Please sign in to comment.