Skip to content

Commit 0046f12

Browse files
committed
more robust test for modeBar.destroy
1 parent fc47c72 commit 0046f12

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: test/jasmine/tests/modebar_test.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('ModeBar', function() {
2929
function getMockGraphInfo(xaxes, yaxes) {
3030
return {
3131
_fullLayout: {
32+
_uid: '6ea6a7',
3233
dragmode: 'zoom',
3334
_paperdiv: d3.select(getMockContainerTree()),
3435
_has: Plots._hasPlotType,
@@ -292,16 +293,19 @@ describe('ModeBar', function() {
292293

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

297-
var style = document.querySelector('style[id*="modebar"]');
300+
301+
var style = document.querySelector(styleSelector);
298302
expect(style).toBeTruthy();
299303

300304
modeBar.destroy();
301305

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

304-
style = document.querySelector('style[id*="modebar"]');
308+
style = document.querySelector(styleSelector);
305309
expect(style).toBeNull();
306310
});
307311
});

0 commit comments

Comments
 (0)