@@ -30,8 +30,6 @@ function move(fromX, fromY, toX, toY, delay) {
30
30
}
31
31
32
32
describe ( 'Test Geo layout defaults' , function ( ) {
33
- 'use strict' ;
34
-
35
33
var layoutAttributes = Geo . layoutAttributes ;
36
34
var supplyLayoutDefaults = Geo . supplyLayoutDefaults ;
37
35
@@ -461,8 +459,6 @@ describe('Test Geo layout defaults', function() {
461
459
} ) ;
462
460
463
461
describe ( 'geojson / topojson utils' , function ( ) {
464
- 'use strict' ;
465
-
466
462
function _locationToFeature ( topojson , loc , locationmode ) {
467
463
var trace = { locationmode : locationmode } ;
468
464
var features = topojsonUtils . getTopojsonFeatures ( trace , topojson ) ;
@@ -523,8 +519,6 @@ describe('geojson / topojson utils', function() {
523
519
} ) ;
524
520
525
521
describe ( 'Test geo interactions' , function ( ) {
526
- 'use strict' ;
527
-
528
522
afterEach ( destroyGraphDiv ) ;
529
523
530
524
describe ( 'mock geo_first.json' , function ( ) {
@@ -1166,8 +1160,49 @@ describe('Test geo interactions', function() {
1166
1160
. catch ( fail )
1167
1161
. then ( done ) ;
1168
1162
} ) ;
1169
- } ) ;
1170
1163
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
+ } ) ;
1171
1206
1172
1207
describe ( 'Test event property of interactions on a geo plot:' , function ( ) {
1173
1208
var mock = require ( '@mocks/geo_scattergeo-locations.json' ) ;
0 commit comments