@@ -440,10 +440,10 @@ describe('sankey tests', function() {
440440 'node.hoverlabel.bordercolor' : 'blue' ,
441441 'node.hoverlabel.font.size' : 20 ,
442442 'node.hoverlabel.font.color' : 'black' ,
443- 'link.hoverlabel.bgcolor' : 'red ' ,
444- 'link.hoverlabel.bordercolor' : 'blue ' ,
445- 'link.hoverlabel.font.size' : 20 ,
446- 'link.hoverlabel.font.color' : 'black '
443+ 'link.hoverlabel.bgcolor' : 'yellow ' ,
444+ 'link.hoverlabel.bordercolor' : 'magenta ' ,
445+ 'link.hoverlabel.font.size' : 18 ,
446+ 'link.hoverlabel.font.color' : 'green '
447447 } ) ;
448448 } )
449449 . then ( function ( ) {
@@ -459,7 +459,7 @@ describe('sankey tests', function() {
459459
460460 assertLabel (
461461 [ 'source: Solid' , 'target: Industry' , '46TWh' ] ,
462- [ 'rgb(255, 0 , 0)' , 'rgb(0 , 0, 255)' , 20 , 'Roboto' , 'rgb(0, 0 , 0)' ]
462+ [ 'rgb(255, 255 , 0)' , 'rgb(255 , 0, 255)' , 18 , 'Roboto' , 'rgb(0, 128 , 0)' ]
463463 ) ;
464464 } )
465465 . catch ( failTest )
@@ -547,6 +547,21 @@ describe('sankey tests', function() {
547547 . catch ( failTest )
548548 . then ( done ) ;
549549 } ) ;
550+
551+ it ( 'should not show link labels if link.hoverinfo is skip' , function ( done ) {
552+ var gd = createGraphDiv ( ) ;
553+ var mockCopy = Lib . extendDeep ( { } , mock ) ;
554+
555+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
556+ return Plotly . restyle ( gd , 'link.hoverinfo' , 'skip' ) ;
557+ } )
558+ . then ( function ( ) {
559+ _hover ( link [ 0 ] , link [ 1 ] ) ;
560+ assertNoLabel ( ) ;
561+ } )
562+ . catch ( failTest )
563+ . then ( done ) ;
564+ } ) ;
550565 } ) ;
551566
552567 describe ( 'Test hover/click event data:' , function ( ) {
@@ -667,24 +682,26 @@ describe('sankey tests', function() {
667682 } ) ;
668683
669684 function assertNoHoverEvents ( type ) {
670- return Promise . resolve ( )
671- . then ( function ( ) { return _hover ( type ) ; } )
672- . then ( failTest ) . catch ( function ( err ) {
673- expect ( err ) . toBe ( 'plotly_hover did not get called!' ) ;
674- } )
675- . then ( function ( ) { return _unhover ( type ) ; } )
676- . then ( failTest ) . catch ( function ( err ) {
677- expect ( err ) . toBe ( 'plotly_unhover did not get called!' ) ;
678- } ) ;
685+ return function ( ) {
686+ return Promise . resolve ( )
687+ . then ( function ( ) { return _hover ( type ) ; } )
688+ . then ( failTest ) . catch ( function ( err ) {
689+ expect ( err ) . toBe ( 'plotly_hover did not get called!' ) ;
690+ } )
691+ . then ( function ( ) { return _unhover ( type ) ; } )
692+ . then ( failTest ) . catch ( function ( err ) {
693+ expect ( err ) . toBe ( 'plotly_unhover did not get called!' ) ;
694+ } ) ;
695+ } ;
679696 }
680697
681698 it ( 'should not output hover/unhover event data when hovermoder is false' , function ( done ) {
682699 var fig = Lib . extendDeep ( { } , mock ) ;
683700
684701 Plotly . plot ( gd , fig )
685702 . then ( function ( ) { return Plotly . relayout ( gd , 'hovermode' , false ) ; } )
686- . then ( function ( ) { return assertNoHoverEvents ( 'node' ) ; } )
687- . then ( function ( ) { return assertNoHoverEvents ( 'link' ) ; } )
703+ . then ( assertNoHoverEvents ( 'node' ) )
704+ . then ( assertNoHoverEvents ( 'link' ) )
688705 . catch ( failTest )
689706 . then ( done ) ;
690707 } ) ;
@@ -694,7 +711,9 @@ describe('sankey tests', function() {
694711
695712 Plotly . plot ( gd , fig )
696713 . then ( function ( ) { return Plotly . restyle ( gd , 'link.hoverinfo' , 'skip' ) ; } )
697- . then ( function ( ) { return assertNoHoverEvents ( 'link' ) ; } )
714+ . then ( assertNoHoverEvents ( 'link' ) )
715+ . then ( function ( ) { return Plotly . restyle ( gd , 'node.hoverinfo' , 'skip' ) ; } )
716+ . then ( assertNoHoverEvents ( 'node' ) )
698717 . catch ( failTest )
699718 . then ( done ) ;
700719 } ) ;
0 commit comments