@@ -932,48 +932,28 @@ describe('@gl parcoords basic use', function() {
932
932
} ) ;
933
933
934
934
it ( 'Should emit a \'plotly_hover\' event' , function ( done ) {
935
+ var hoverCalls = 0 ;
936
+ var unhoverCalls = 0 ;
935
937
936
- function testMaker ( ) {
938
+ gd . on ( 'plotly_hover' , function ( ) { hoverCalls ++ ; } ) ;
939
+ gd . on ( 'plotly_unhover' , function ( ) { unhoverCalls ++ ; } ) ;
937
940
938
- var eventCalled = false ;
939
-
940
- return {
941
- set : function ( ) { eventCalled = eventCalled || true ; } ,
942
- get : function ( ) { return eventCalled ; }
943
- } ;
944
- }
945
-
946
- var hoverTester = testMaker ( ) ;
947
- var unhoverTester = testMaker ( ) ;
948
-
949
- gd . on ( 'plotly_hover' , function ( d ) {
950
- hoverTester . set ( { hover : d } ) ;
951
- } ) ;
952
-
953
- gd . on ( 'plotly_unhover' , function ( d ) {
954
- unhoverTester . set ( { unhover : d } ) ;
955
- } ) ;
956
-
957
- expect ( hoverTester . get ( ) ) . toBe ( false ) ;
958
- expect ( unhoverTester . get ( ) ) . toBe ( false ) ;
941
+ expect ( hoverCalls ) . toBe ( 0 ) ;
942
+ expect ( unhoverCalls ) . toBe ( 0 ) ;
959
943
960
944
mouseTo ( 324 , 216 ) ;
961
945
mouseTo ( 315 , 218 ) ;
962
946
963
- new Promise ( function ( resolve ) {
964
- window . setTimeout ( function ( ) {
965
-
966
- expect ( hoverTester . get ( ) ) . toBe ( true ) ;
967
-
968
- mouseTo ( 329 , 153 ) ;
969
-
970
- window . setTimeout ( function ( ) {
971
-
972
- expect ( unhoverTester . get ( ) ) . toBe ( true ) ;
973
- resolve ( ) ;
974
- } , 20 ) ;
975
-
976
- } , 20 ) ;
947
+ delay ( 20 ) ( )
948
+ . then ( function ( ) {
949
+ expect ( hoverCalls ) . toBe ( 1 ) ;
950
+ expect ( unhoverCalls ) . toBe ( 0 ) ;
951
+ mouseTo ( 329 , 153 ) ;
952
+ } )
953
+ . then ( delay ( 20 ) )
954
+ . then ( function ( ) {
955
+ expect ( hoverCalls ) . toBe ( 1 ) ;
956
+ expect ( unhoverCalls ) . toBe ( 1 ) ;
977
957
} )
978
958
. catch ( failTest )
979
959
. then ( done ) ;
@@ -1060,7 +1040,7 @@ describe('@gl parcoords basic use', function() {
1060
1040
} ) ;
1061
1041
} ) ;
1062
1042
1063
- describe ( '@gl @noCI parcoords constraint interactions' , function ( ) {
1043
+ describe ( '@gl parcoords constraint interactions' , function ( ) {
1064
1044
var gd , initialDashArray0 , initialDashArray1 ;
1065
1045
1066
1046
function initialFigure ( ) {
0 commit comments