@@ -713,6 +713,38 @@ describe('ModeBar', function() {
713713 checkButtons ( modeBar , buttons , 1 ) ;
714714 } ) ;
715715
716+ it ( 'creates mode bar without hover button when all traces are noHover' , function ( ) {
717+ var buttons = getButtons ( [
718+ [ 'toImage' ]
719+ ] ) ;
720+
721+ var gd = getMockGraphInfo ( ) ;
722+ gd . _context . modeBarButtonsToAdd = [ 'hoverclosest' ] ;
723+ gd . _fullData = [ { type : 'indicator' } ] ;
724+
725+ manageModeBar ( gd ) ;
726+ var modeBar = gd . _fullLayout . _modeBar ;
727+
728+ checkButtons ( modeBar , buttons , 1 ) ;
729+ } ) ;
730+
731+ it ( 'creates mode bar with hover button even in the presence of one noHover trace' , function ( ) {
732+ var buttons = getButtons ( [
733+ [ 'toImage' ] ,
734+ [ 'hoverClosestPie' ]
735+ ] ) ;
736+
737+ var gd = getMockGraphInfo ( ) ;
738+ gd . _context . modeBarButtonsToAdd = [ 'hoverclosest' ] ;
739+ gd . _fullLayout . _basePlotModules = [ { name : 'pie' } ] ;
740+ gd . _fullData = [ { type : 'indicator' } , { type : 'pie' } ] ;
741+
742+ manageModeBar ( gd ) ;
743+ var modeBar = gd . _fullLayout . _modeBar ;
744+
745+ checkButtons ( modeBar , buttons , 1 ) ;
746+ } ) ;
747+
716748 it ( 'throws an error if modeBarButtonsToRemove isn\'t an array' , function ( ) {
717749 var gd = getMockGraphInfo ( ) ;
718750 gd . _context . modeBarButtonsToRemove = 'not gonna work' ;
0 commit comments