@@ -30,8 +30,6 @@ function move(fromX, fromY, toX, toY, delay) {
3030}
3131
3232describe ( 'Test Geo layout defaults' , function ( ) {
33- 'use strict' ;
34-
3533 var layoutAttributes = Geo . layoutAttributes ;
3634 var supplyLayoutDefaults = Geo . supplyLayoutDefaults ;
3735
@@ -461,8 +459,6 @@ describe('Test Geo layout defaults', function() {
461459} ) ;
462460
463461describe ( 'geojson / topojson utils' , function ( ) {
464- 'use strict' ;
465-
466462 function _locationToFeature ( topojson , loc , locationmode ) {
467463 var trace = { locationmode : locationmode } ;
468464 var features = topojsonUtils . getTopojsonFeatures ( trace , topojson ) ;
@@ -523,8 +519,6 @@ describe('geojson / topojson utils', function() {
523519} ) ;
524520
525521describe ( 'Test geo interactions' , function ( ) {
526- 'use strict' ;
527-
528522 afterEach ( destroyGraphDiv ) ;
529523
530524 describe ( 'mock geo_first.json' , function ( ) {
@@ -1166,8 +1160,49 @@ describe('Test geo interactions', function() {
11661160 . catch ( fail )
11671161 . then ( done ) ;
11681162 } ) ;
1169- } ) ;
11701163
1164+ it ( '@noCI should clear hover label when cursor slips off subplot' , function ( done ) {
1165+ var gd = createGraphDiv ( ) ;
1166+ var fig = Lib . extendDeep ( { } , require ( '@mocks/geo_orthographic.json' ) ) ;
1167+
1168+ function _assert ( msg , hoverLabelCnt ) {
1169+ expect ( d3 . selectAll ( 'g.hovertext' ) . size ( ) )
1170+ . toBe ( hoverLabelCnt , msg ) ;
1171+ }
1172+
1173+ var px = 390 ;
1174+ var py = 290 ;
1175+ var cnt = 0 ;
1176+
1177+ Plotly . plot ( gd , fig ) . then ( function ( ) {
1178+ gd . on ( 'plotly_unhover' , function ( ) { cnt ++ ; } ) ;
1179+
1180+ mouseEvent ( 'mousemove' , px , py ) ;
1181+ _assert ( 'base state' , 1 ) ;
1182+
1183+ return new Promise ( function ( resolve ) {
1184+ var interval = setInterval ( function ( ) {
1185+ px += 2 ;
1186+ mouseEvent ( 'mousemove' , px , py ) ;
1187+
1188+ if ( px < 402 ) {
1189+ _assert ( '- px ' + px , 1 ) ;
1190+ expect ( cnt ) . toBe ( 0 , 'no plotly_unhover event so far' ) ;
1191+ } else {
1192+ _assert ( '- px ' + px , 0 ) ;
1193+ expect ( cnt ) . toBe ( 1 , 'plotly_unhover event count' ) ;
1194+
1195+ clearInterval ( interval ) ;
1196+ resolve ( ) ;
1197+ }
1198+ } , 100 ) ;
1199+ } ) ;
1200+ } )
1201+ . catch ( fail )
1202+ . then ( done ) ;
1203+ } ) ;
1204+
1205+ } ) ;
11711206
11721207describe ( 'Test event property of interactions on a geo plot:' , function ( ) {
11731208 var mock = require ( '@mocks/geo_scattergeo-locations.json' ) ;
0 commit comments