@@ -4014,10 +4014,11 @@ describe('hovermode: (x|y)unified', function() {
4014
4014
} ) ;
4015
4015
}
4016
4016
4017
- function assertBgcolor ( color ) {
4017
+ function assertRectColor ( color , bordercolor ) {
4018
4018
var hover = getHoverLabel ( ) ;
4019
4019
var bg = hover . select ( 'rect.bg' ) ;
4020
- expect ( bg . node ( ) . style . fill ) . toBe ( color ) ;
4020
+ if ( color ) expect ( bg . node ( ) . style . fill ) . toBe ( color ) ;
4021
+ if ( bordercolor ) expect ( bg . node ( ) . style . stroke ) . toBe ( bordercolor ) ;
4021
4022
}
4022
4023
4023
4024
function assertSymbol ( exp ) {
@@ -4329,7 +4330,7 @@ describe('hovermode: (x|y)unified', function() {
4329
4330
. then ( done ) ;
4330
4331
} ) ;
4331
4332
4332
- it ( 'label should have color of hoverlabel.bgcolor or legend.bgcolor or paper_bgcolor' , function ( done ) {
4333
+ it ( 'label should have bgcolor/bordercolor from hoverlabel or legend or paper_bgcolor' , function ( done ) {
4333
4334
var mockCopy = Lib . extendDeep ( { } , mock ) ;
4334
4335
var bgcolor = [
4335
4336
'rgb(10, 10, 10)' ,
@@ -4342,49 +4343,53 @@ describe('hovermode: (x|y)unified', function() {
4342
4343
. then ( function ( gd ) {
4343
4344
_hover ( gd , { xval : 3 } ) ;
4344
4345
4345
- assertBgcolor ( 'rgb(255, 255, 255)' ) ;
4346
+ assertRectColor ( 'rgb(255, 255, 255)' , 'rgb(68, 68, 68 )') ;
4346
4347
4347
4348
// Set paper_bgcolor
4348
4349
return Plotly . relayout ( gd , 'paper_bgcolor' , bgcolor [ 0 ] ) ;
4349
4350
} )
4350
4351
. then ( function ( gd ) {
4351
4352
_hover ( gd , { xval : 3 } ) ;
4352
4353
4353
- assertBgcolor ( bgcolor [ 0 ] ) ;
4354
+ assertRectColor ( bgcolor [ 0 ] ) ;
4354
4355
4355
4356
// Set legend.bgcolor which should win over paper_bgcolor
4356
4357
return Plotly . relayout ( gd , {
4357
4358
'showlegend' : true ,
4358
- 'legend.bgcolor' : bgcolor [ 1 ]
4359
+ 'legend.bgcolor' : bgcolor [ 1 ] ,
4360
+ 'legend.bordercolor' : bgcolor [ 1 ]
4359
4361
} ) ;
4360
4362
} )
4361
4363
. then ( function ( gd ) {
4362
4364
_hover ( gd , { xval : 3 } ) ;
4363
4365
4364
- assertBgcolor ( bgcolor [ 1 ] ) ;
4366
+ assertRectColor ( bgcolor [ 1 ] , bgcolor [ 1 ] ) ;
4365
4367
4366
4368
// Set hoverlabel.bgcolor which should win over legend.bgcolor
4367
- return Plotly . relayout ( gd , 'hoverlabel.bgcolor' , bgcolor [ 2 ] ) ;
4369
+ return Plotly . relayout ( gd , {
4370
+ 'hoverlabel.bgcolor' : bgcolor [ 2 ] ,
4371
+ 'hoverlabel.bordercolor' : bgcolor [ 2 ]
4372
+ } ) ;
4368
4373
} )
4369
4374
. then ( function ( gd ) {
4370
4375
_hover ( gd , { xval : 3 } ) ;
4371
4376
4372
- assertBgcolor ( bgcolor [ 2 ] ) ;
4377
+ assertRectColor ( bgcolor [ 2 ] , bgcolor [ 2 ] ) ;
4373
4378
4374
4379
// Finally, check that a hoverlabel.bgcolor defined in template wins
4375
4380
delete mockCopy . layout ;
4376
4381
mockCopy . layout = {
4377
4382
hovermode : 'x unified' ,
4378
- template : { layout : { hoverlabel : { bgcolor : bgcolor [ 3 ] } } } ,
4379
- legend : { bgcolor : bgcolor [ 1 ] }
4383
+ template : { layout : { hoverlabel : { bgcolor : bgcolor [ 3 ] , bordercolor : bgcolor [ 3 ] } } } ,
4384
+ legend : { bgcolor : bgcolor [ 1 ] , bordercolor : bgcolor [ 1 ] }
4380
4385
} ;
4381
4386
4382
4387
return Plotly . newPlot ( gd , mockCopy ) ;
4383
4388
} )
4384
4389
. then ( function ( gd ) {
4385
4390
_hover ( gd , { xval : 3 } ) ;
4386
4391
4387
- assertBgcolor ( bgcolor [ 3 ] ) ;
4392
+ assertRectColor ( bgcolor [ 3 ] , bgcolor [ 3 ] ) ;
4388
4393
} )
4389
4394
. catch ( failTest )
4390
4395
. then ( done ) ;
0 commit comments