@@ -27,12 +27,19 @@ describe('ModeBar', function() {
2727 return parent ;
2828 }
2929
30+ function getMockModeBarTree ( ) {
31+ var el = document . createElement ( 'div' ) ;
32+ el . className = 'modebar-container' ;
33+ return el ;
34+ }
35+
3036 function getMockGraphInfo ( xaxes , yaxes ) {
3137 return {
3238 _fullLayout : {
3339 _uid : '6ea6a7' ,
3440 dragmode : 'zoom' ,
3541 _paperdiv : d3 . select ( getMockContainerTree ( ) ) ,
42+ _modebardiv : d3 . select ( getMockModeBarTree ( ) ) ,
3643 _has : Plots . _hasPlotType ,
3744 _subplots : { xaxis : xaxes || [ ] , yaxis : yaxes || [ ] } ,
3845 modebar : {
@@ -1349,13 +1356,13 @@ describe('ModeBar', function() {
13491356 it ( 'changes background color (displayModeBar: hover)' , function ( done ) {
13501357 Plotly . plot ( gd , [ ] , { modebar : { bgcolor : colors [ 0 ] } } )
13511358 . then ( function ( ) {
1352- style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element ) ;
1359+ style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element . querySelector ( '.modebar-group' ) ) ;
13531360 expect ( style . backgroundColor ) . toBe ( 'rgba(0, 0, 0, 0)' ) ;
13541361 expect ( getStyleRule ( ) . rules [ 3 ] . style . backgroundColor ) . toBe ( colors [ 0 ] ) ;
13551362 } )
13561363 . then ( function ( ) { return Plotly . relayout ( gd , 'modebar.bgcolor' , colors [ 1 ] ) ; } )
13571364 . then ( function ( ) {
1358- style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element ) ;
1365+ style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element . querySelector ( '.modebar-group' ) ) ;
13591366 expect ( style . backgroundColor ) . toBe ( 'rgba(0, 0, 0, 0)' ) ;
13601367 expect ( getStyleRule ( ) . rules [ 3 ] . style . backgroundColor ) . toBe ( colors [ 1 ] ) ;
13611368 } )
@@ -1366,13 +1373,13 @@ describe('ModeBar', function() {
13661373 it ( 'changes background color (displayModeBar: true)' , function ( done ) {
13671374 Plotly . plot ( gd , [ ] , { modebar : { bgcolor : colors [ 0 ] } } , { displayModeBar : true } )
13681375 . then ( function ( ) {
1369- style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element ) ;
1376+ style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element . querySelector ( '.modebar-group' ) ) ;
13701377 expect ( style . backgroundColor ) . toBe ( colors [ 0 ] ) ;
13711378 expect ( getStyleRule ( ) . rules [ 3 ] . style . backgroundColor ) . toBe ( colors [ 0 ] ) ;
13721379 } )
13731380 . then ( function ( ) { return Plotly . relayout ( gd , 'modebar.bgcolor' , colors [ 1 ] ) ; } )
13741381 . then ( function ( ) {
1375- style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element ) ;
1382+ style = window . getComputedStyle ( gd . _fullLayout . _modeBar . element . querySelector ( '.modebar-group' ) ) ;
13761383 expect ( style . backgroundColor ) . toBe ( colors [ 1 ] ) ;
13771384 expect ( getStyleRule ( ) . rules [ 3 ] . style . backgroundColor ) . toBe ( colors [ 1 ] ) ;
13781385 } )
0 commit comments