@@ -41,6 +41,7 @@ describe('ModeBar', function() {
4141 _modebardiv : d3 . select ( getMockModeBarTree ( ) ) ,
4242 _has : Plots . _hasPlotType ,
4343 _subplots : { xaxis : xaxes || [ ] , yaxis : yaxes || [ ] } ,
44+ _basePlotModules : [ ] ,
4445 modebar : {
4546 orientation : 'h' ,
4647 bgcolor : 'rgba(255,255,255,0.7)' ,
@@ -719,6 +720,35 @@ describe('ModeBar', function() {
719720 checkButtons ( modeBar , buttons , 1 ) ;
720721 } ) ;
721722
723+ it ( 'creates mode bar without hover button when all traces are noHover' , function ( ) {
724+ var buttons = getButtons ( [
725+ [ 'toImage' ]
726+ ] ) ;
727+
728+ var gd = getMockGraphInfo ( ) ;
729+ gd . _fullLayout . _basePlotModules = [ { name : 'indicator' } ] ;
730+
731+ manageModeBar ( gd ) ;
732+ var modeBar = gd . _fullLayout . _modeBar ;
733+
734+ checkButtons ( modeBar , buttons , 1 ) ;
735+ } ) ;
736+
737+ it ( 'creates mode bar with hover button even in the presence of one noHover trace' , function ( ) {
738+ var buttons = getButtons ( [
739+ [ 'toImage' ] ,
740+ [ 'hoverClosestPie' ]
741+ ] ) ;
742+
743+ var gd = getMockGraphInfo ( ) ;
744+ gd . _fullLayout . _basePlotModules = [ { name : 'indicator' } , { name : 'pie' } ] ;
745+
746+ manageModeBar ( gd ) ;
747+ var modeBar = gd . _fullLayout . _modeBar ;
748+
749+ checkButtons ( modeBar , buttons , 1 ) ;
750+ } ) ;
751+
722752 it ( 'throws an error if modeBarButtonsToRemove isn\'t an array' , function ( ) {
723753 var gd = getMockGraphInfo ( ) ;
724754 gd . _context . modeBarButtonsToRemove = 'not gonna work' ;
0 commit comments