@@ -816,6 +816,10 @@ describe('sankey tests', function() {
816816 it ( 'should show the correct hover labels when hovertemplate is specified' , function ( done ) {
817817 var gd = createGraphDiv ( ) ;
818818 var mockCopy = Lib . extendDeep ( { } , mock ) ;
819+ mockCopy . data [ 0 ] . node . customdata = [ ] ;
820+ mockCopy . data [ 0 ] . node . customdata [ 4 ] = [ 'nodeCustomdata0' , 'nodeCustomdata1' ] ;
821+ mockCopy . data [ 0 ] . link . customdata = [ ] ;
822+ mockCopy . data [ 0 ] . link . customdata [ 61 ] = [ 'linkCustomdata0' , 'linkCustomdata1' ] ;
819823
820824 Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
821825 _hover ( 404 , 302 ) ;
@@ -836,23 +840,23 @@ describe('sankey tests', function() {
836840 // Test (node|link).hovertemplate
837841 . then ( function ( ) {
838842 return Plotly . restyle ( gd , {
839- 'node.hovertemplate' : 'hovertemplate<br>%{value}<br>%{value:0.2f}<extra>%{fullData.name}</extra>' ,
840- 'link.hovertemplate' : 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<extra>%{fullData.name}</extra>'
843+ 'node.hovertemplate' : 'hovertemplate<br>%{value}<br>%{value:0.2f}<br>%{customdata[0]}/%{customdata[1]}< extra>%{fullData.name}</extra>' ,
844+ 'link.hovertemplate' : 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<br>%{customdata[1]}< extra>%{fullData.name}</extra>'
841845 } ) ;
842846 } )
843847 . then ( function ( ) {
844848 _hover ( 404 , 302 ) ;
845849
846850 assertLabel (
847- [ 'hovertemplate' , '447TWh' , '447.48' , 'trace 0' ] ,
851+ [ 'hovertemplate' , '447TWh' , '447.48' , 'nodeCustomdata0/nodeCustomdata1' , ' trace 0'] ,
848852 [ 'rgb(148, 103, 189)' , 'rgb(255, 255, 255)' , 13 , 'Arial' , 'rgb(255, 255, 255)' ]
849853 ) ;
850854 } )
851855 . then ( function ( ) {
852856 _hover ( 450 , 300 ) ;
853857
854858 assertLabel (
855- [ 'hovertemplate' , 'source: Solid' , 'target: Industry' , 'size: 46TWh' , 'trace 0' ] ,
859+ [ 'hovertemplate' , 'source: Solid' , 'target: Industry' , 'size: 46TWh' , 'linkCustomdata1' , ' trace 0'] ,
856860 [ 'rgb(0, 0, 96)' , 'rgb(255, 255, 255)' , 13 , 'Arial' , 'rgb(255, 255, 255)' ]
857861 ) ;
858862 } )
0 commit comments