@@ -440,10 +440,10 @@ describe('sankey tests', function() {
440
440
'node.hoverlabel.bordercolor' : 'blue' ,
441
441
'node.hoverlabel.font.size' : 20 ,
442
442
'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 '
447
447
} ) ;
448
448
} )
449
449
. then ( function ( ) {
@@ -459,7 +459,7 @@ describe('sankey tests', function() {
459
459
460
460
assertLabel (
461
461
[ '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)' ]
463
463
) ;
464
464
} )
465
465
. catch ( failTest )
@@ -547,6 +547,21 @@ describe('sankey tests', function() {
547
547
. catch ( failTest )
548
548
. then ( done ) ;
549
549
} ) ;
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
+ } ) ;
550
565
} ) ;
551
566
552
567
describe ( 'Test hover/click event data:' , function ( ) {
@@ -667,24 +682,26 @@ describe('sankey tests', function() {
667
682
} ) ;
668
683
669
684
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
+ } ;
679
696
}
680
697
681
698
it ( 'should not output hover/unhover event data when hovermoder is false' , function ( done ) {
682
699
var fig = Lib . extendDeep ( { } , mock ) ;
683
700
684
701
Plotly . plot ( gd , fig )
685
702
. 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' ) )
688
705
. catch ( failTest )
689
706
. then ( done ) ;
690
707
} ) ;
@@ -694,7 +711,9 @@ describe('sankey tests', function() {
694
711
695
712
Plotly . plot ( gd , fig )
696
713
. 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' ) )
698
717
. catch ( failTest )
699
718
. then ( done ) ;
700
719
} ) ;
0 commit comments