@@ -13,6 +13,7 @@ var mouseEvent = require('../assets/mouse_event');
13
13
var customAssertions = require ( '../assets/custom_assertions' ) ;
14
14
var assertHoverLabelStyle = customAssertions . assertHoverLabelStyle ;
15
15
var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
16
+ var fail = require ( '../assets/fail_test' ) ;
16
17
17
18
describe ( 'Test scattergeo defaults' , function ( ) {
18
19
var traceIn ,
@@ -246,6 +247,7 @@ describe('Test scattergeo hover', function() {
246
247
lat : [ 10 , 20 , 30 ] ,
247
248
text : [ 'A' , 'B' , 'C' ]
248
249
} ] )
250
+ . catch ( fail )
249
251
. then ( done ) ;
250
252
} ) ;
251
253
@@ -280,27 +282,31 @@ describe('Test scattergeo hover', function() {
280
282
Plotly . restyle ( gd , 'hoverinfo' , 'lon+lat+text+name' ) . then ( function ( ) {
281
283
check ( [ 381 , 221 ] , [ '(10°, 10°)\nA' , 'trace 0' ] ) ;
282
284
} )
285
+ . catch ( fail )
283
286
. then ( done ) ;
284
287
} ) ;
285
288
286
289
it ( 'should generate hover label info (\'text\' single value case)' , function ( done ) {
287
290
Plotly . restyle ( gd , 'text' , 'text' ) . then ( function ( ) {
288
291
check ( [ 381 , 221 ] , [ '(10°, 10°)\ntext' , null ] ) ;
289
292
} )
293
+ . catch ( fail )
290
294
. then ( done ) ;
291
295
} ) ;
292
296
293
297
it ( 'should generate hover label info (\'hovertext\' single value case)' , function ( done ) {
294
298
Plotly . restyle ( gd , 'hovertext' , 'hovertext' ) . then ( function ( ) {
295
299
check ( [ 381 , 221 ] , [ '(10°, 10°)\nhovertext' , null ] ) ;
296
300
} )
301
+ . catch ( fail )
297
302
. then ( done ) ;
298
303
} ) ;
299
304
300
305
it ( 'should generate hover label info (\'hovertext\' array case)' , function ( done ) {
301
306
Plotly . restyle ( gd , 'hovertext' , [ 'Apple' , 'Banana' , 'Orange' ] ) . then ( function ( ) {
302
307
check ( [ 381 , 221 ] , [ '(10°, 10°)\nApple' , null ] ) ;
303
308
} )
309
+ . catch ( fail )
304
310
. then ( done ) ;
305
311
} ) ;
306
312
@@ -318,13 +324,40 @@ describe('Test scattergeo hover', function() {
318
324
fontFamily : 'Arial'
319
325
} ) ;
320
326
} )
327
+ . catch ( fail )
321
328
. then ( done ) ;
322
329
} ) ;
323
330
324
331
it ( 'should generate hover label with arrayOk \'hoverinfo\' settings' , function ( done ) {
325
332
Plotly . restyle ( gd , 'hoverinfo' , [ [ 'lon' , null , 'lat+name' ] ] ) . then ( function ( ) {
326
333
check ( [ 381 , 221 ] , [ 'lon: 10°' , null ] ) ;
327
334
} )
335
+ . catch ( fail )
336
+ . then ( done ) ;
337
+ } ) ;
338
+ } ) ;
339
+
340
+ describe ( 'scattergeo bad data' , function ( ) {
341
+ var gd ;
342
+
343
+ beforeEach ( function ( ) {
344
+ gd = createGraphDiv ( ) ;
345
+ } ) ;
346
+
347
+ afterEach ( destroyGraphDiv ) ;
348
+
349
+ it ( 'should not throw an error with bad locations' , function ( done ) {
350
+ spyOn ( Lib , 'warn' ) ;
351
+ Plotly . newPlot ( gd , [ {
352
+ locations : [ 'canada' , 0 , null , '' , 'utopia' ] ,
353
+ locationmode : 'country names' ,
354
+ type : 'scattergeo'
355
+ } ] )
356
+ . then ( function ( ) {
357
+ // only utopia warns - others are silently ignored
358
+ expect ( Lib . warn ) . toHaveBeenCalledTimes ( 1 ) ;
359
+ } )
360
+ . catch ( fail )
328
361
. then ( done ) ;
329
362
} ) ;
330
363
} ) ;
0 commit comments