File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ module.exports = function manageModeBar(gd) {
27
27
context = gd . _context ,
28
28
modeBar = fullLayout . _modeBar ;
29
29
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
+ }
33
35
return ;
34
36
}
35
37
Original file line number Diff line number Diff line change @@ -290,6 +290,14 @@ describe('ModeBar', function() {
290
290
} ) ;
291
291
292
292
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 ( ) {
293
301
var gd = getMockGraphInfo ( ) ;
294
302
manageModeBar ( gd ) ;
295
303
expect ( gd . _fullLayout . _modeBar ) . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments