Skip to content

Commit cfb006c

Browse files
committed
Merge pull request #57 from plotly/fix-display-modebar
Fix logic for display modebar plot config [fixes #56]
2 parents c88fb5a + ae642be commit cfb006c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/modebar/manage.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ module.exports = function manageModeBar(gd) {
2727
context = gd._context,
2828
modeBar = fullLayout._modeBar;
2929

30-
if(!context.displayModeBar && modeBar) {
31-
modeBar.destroy();
32-
delete fullLayout._modeBar;
30+
if(!context.displayModeBar) {
31+
if(modeBar) {
32+
modeBar.destroy();
33+
delete fullLayout._modeBar;
34+
}
3335
return;
3436
}
3537

test/jasmine/tests/modebar_test.js

+8
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,14 @@ describe('ModeBar', function() {
290290
});
291291

292292
it('displays or not mode bar according to displayModeBar config arg', function() {
293+
var gd = getMockGraphInfo();
294+
gd._context.displayModeBar = false;
295+
296+
manageModeBar(gd);
297+
expect(gd._fullLayout._modeBar).not.toBeDefined();
298+
});
299+
300+
it('updates mode bar according to displayModeBar config arg', function() {
293301
var gd = getMockGraphInfo();
294302
manageModeBar(gd);
295303
expect(gd._fullLayout._modeBar).toBeDefined();

0 commit comments

Comments
 (0)