@@ -41,6 +41,7 @@ describe('ModeBar', function() {
41
41
_modebardiv : d3 . select ( getMockModeBarTree ( ) ) ,
42
42
_has : Plots . _hasPlotType ,
43
43
_subplots : { xaxis : xaxes || [ ] , yaxis : yaxes || [ ] } ,
44
+ _basePlotModules : [ ] ,
44
45
modebar : {
45
46
orientation : 'h' ,
46
47
bgcolor : 'rgba(255,255,255,0.7)' ,
@@ -719,6 +720,35 @@ describe('ModeBar', function() {
719
720
checkButtons ( modeBar , buttons , 1 ) ;
720
721
} ) ;
721
722
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
+
722
752
it ( 'throws an error if modeBarButtonsToRemove isn\'t an array' , function ( ) {
723
753
var gd = getMockGraphInfo ( ) ;
724
754
gd . _context . modeBarButtonsToRemove = 'not gonna work' ;
0 commit comments