@@ -932,48 +932,28 @@ describe('@gl parcoords basic use', function() {
932932 } ) ;
933933
934934 it ( 'Should emit a \'plotly_hover\' event' , function ( done ) {
935+ var hoverCalls = 0 ;
936+ var unhoverCalls = 0 ;
935937
936- function testMaker ( ) {
938+ gd . on ( 'plotly_hover' , function ( ) { hoverCalls ++ ; } ) ;
939+ gd . on ( 'plotly_unhover' , function ( ) { unhoverCalls ++ ; } ) ;
937940
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 ) ;
959943
960944 mouseTo ( 324 , 216 ) ;
961945 mouseTo ( 315 , 218 ) ;
962946
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 ) ;
977957 } )
978958 . catch ( failTest )
979959 . then ( done ) ;
@@ -1060,7 +1040,7 @@ describe('@gl parcoords basic use', function() {
10601040 } ) ;
10611041} ) ;
10621042
1063- describe ( '@gl @noCI parcoords constraint interactions' , function ( ) {
1043+ describe ( '@gl parcoords constraint interactions' , function ( ) {
10641044 var gd , initialDashArray0 , initialDashArray1 ;
10651045
10661046 function initialFigure ( ) {
0 commit comments