Skip to content

Commit

Permalink
more robust test for modeBar.destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerg committed Oct 4, 2018
1 parent fc47c72 commit 0046f12
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/jasmine/tests/modebar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('ModeBar', function() {
function getMockGraphInfo(xaxes, yaxes) {
return {
_fullLayout: {
_uid: '6ea6a7',
dragmode: 'zoom',
_paperdiv: d3.select(getMockContainerTree()),
_has: Plots._hasPlotType,
Expand Down Expand Up @@ -292,16 +293,19 @@ describe('ModeBar', function() {

describe('modeBar.destroy', function() {
it('removes the mode bar entirely', function() {
var modeBarParent = modeBar.element.parentNode;
var modeBarParent = modeBar.element.parentNode,
gd = getMockGraphInfo(),
styleSelector = 'style[id*="modebar-' + gd._fullLayout._uid + '"]';

var style = document.querySelector('style[id*="modebar"]');

var style = document.querySelector(styleSelector);
expect(style).toBeTruthy();

modeBar.destroy();

expect(modeBarParent.querySelector('.modebar')).toBeNull();

style = document.querySelector('style[id*="modebar"]');
style = document.querySelector(styleSelector);
expect(style).toBeNull();
});
});
Expand Down

0 comments on commit 0046f12

Please sign in to comment.