@@ -816,7 +816,10 @@ describe('sankey tests', function() {
816
816
it ( 'should show the correct hover labels when hovertemplate is specified' , function ( done ) {
817
817
var gd = createGraphDiv ( ) ;
818
818
var mockCopy = Lib . extendDeep ( { } , mock ) ;
819
- mockCopy . data [ 0 ] . node . customdata = [ 0 , 0 , 0 , 0 , '15' ]
819
+ mockCopy . data [ 0 ] . node . customdata = [ ] ;
820
+ mockCopy . data [ 0 ] . node . customdata [ 4 ] = 'nodeCustomdata' ;
821
+ mockCopy . data [ 0 ] . link . customdata = [ ] ;
822
+ mockCopy . data [ 0 ] . link . customdata [ 61 ] = 'linkCustomdata' ;
820
823
821
824
Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
822
825
_hover ( 404 , 302 ) ;
@@ -838,22 +841,22 @@ describe('sankey tests', function() {
838
841
. then ( function ( ) {
839
842
return Plotly . restyle ( gd , {
840
843
'node.hovertemplate' : 'hovertemplate<br>%{value}<br>%{value:0.2f}<br>%{customdata}<extra>%{fullData.name}</extra>' ,
841
- 'link.hovertemplate' : 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<extra>%{fullData.name}</extra>'
844
+ 'link.hovertemplate' : 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<br>%{customdata}< extra>%{fullData.name}</extra>'
842
845
} ) ;
843
846
} )
844
847
. then ( function ( ) {
845
848
_hover ( 404 , 302 ) ;
846
849
847
850
assertLabel (
848
- [ 'hovertemplate' , '447TWh' , '447.48' , '15 ' , 'trace 0' ] ,
851
+ [ 'hovertemplate' , '447TWh' , '447.48' , 'nodeCustomdata ' , 'trace 0' ] ,
849
852
[ 'rgb(148, 103, 189)' , 'rgb(255, 255, 255)' , 13 , 'Arial' , 'rgb(255, 255, 255)' ]
850
853
) ;
851
854
} )
852
855
. then ( function ( ) {
853
856
_hover ( 450 , 300 ) ;
854
857
855
858
assertLabel (
856
- [ 'hovertemplate' , 'source: Solid' , 'target: Industry' , 'size: 46TWh' , 'trace 0' ] ,
859
+ [ 'hovertemplate' , 'source: Solid' , 'target: Industry' , 'size: 46TWh' , 'linkCustomdata' , ' trace 0'] ,
857
860
[ 'rgb(0, 0, 96)' , 'rgb(255, 255, 255)' , 13 , 'Arial' , 'rgb(255, 255, 255)' ]
858
861
) ;
859
862
} )
0 commit comments