@@ -26,6 +26,8 @@ var assertElemRightTo = customAssertions.assertElemRightTo;
26
26
var assertElemTopsAligned = customAssertions . assertElemTopsAligned ;
27
27
var assertElemInside = customAssertions . assertElemInside ;
28
28
29
+ var groupTitlesMock = require ( '@mocks/legendgroup-titles' ) ;
30
+
29
31
function touch ( path , options ) {
30
32
var len = path . length ;
31
33
Lib . clearThrottle ( ) ;
@@ -6078,6 +6080,38 @@ describe('hovermode: (x|y)unified', function() {
6078
6080
. then ( done , done . fail ) ;
6079
6081
} ) ;
6080
6082
6083
+ it ( 'should use hoverlabel.font for group titles as well as traces' , function ( done ) {
6084
+ function assertFont ( fontFamily , fontSize , fontColor ) {
6085
+ var hover = getHoverLabel ( ) ;
6086
+ var traces = hover . selectAll ( 'g.traces' ) ;
6087
+
6088
+ traces . each ( function ( ) {
6089
+ var e = d3Select ( this ) ;
6090
+ var text = e . select ( 'text.legendtext' ) ;
6091
+ var node = text . node ( ) ;
6092
+
6093
+ var textStyle = window . getComputedStyle ( node ) ;
6094
+ expect ( textStyle . fontFamily . split ( ',' ) [ 0 ] ) . toBe ( fontFamily , 'wrong font family' ) ;
6095
+ expect ( textStyle . fontSize ) . toBe ( fontSize , 'wrong font size' ) ;
6096
+ expect ( textStyle . fill ) . toBe ( fontColor , 'wrong font color' ) ;
6097
+ } ) ;
6098
+ }
6099
+
6100
+ var mockCopy = Lib . extendDeep ( { } , groupTitlesMock ) ;
6101
+
6102
+ mockCopy . layout . hoverlabel = {
6103
+ font : { size : 20 , family : 'Mono' , color : 'rgb(255, 127, 0)' }
6104
+ } ;
6105
+
6106
+ Plotly . newPlot ( gd , mockCopy )
6107
+ . then ( function ( gd ) {
6108
+ _hover ( gd , { xval : 0 } ) ;
6109
+
6110
+ assertFont ( 'Mono' , '20px' , 'rgb(255, 127, 0)' ) ;
6111
+ } )
6112
+ . then ( done , done . fail ) ;
6113
+ } ) ;
6114
+
6081
6115
it ( 'should work with hovertemplate' , function ( done ) {
6082
6116
var mockCopy = Lib . extendDeep ( { } , mock ) ;
6083
6117
mockCopy . data [ 0 ] . hovertemplate = 'hovertemplate: %{y:0.2f}' ;
0 commit comments