@@ -13,6 +13,7 @@ var mouseEvent = require('../assets/mouse_event');
1313var customAssertions = require ( '../assets/custom_assertions' ) ;
1414var assertHoverLabelStyle = customAssertions . assertHoverLabelStyle ;
1515var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
16+ var fail = require ( '../assets/fail_test' ) ;
1617
1718describe ( 'Test scattergeo defaults' , function ( ) {
1819 var traceIn ,
@@ -246,6 +247,7 @@ describe('Test scattergeo hover', function() {
246247 lat : [ 10 , 20 , 30 ] ,
247248 text : [ 'A' , 'B' , 'C' ]
248249 } ] )
250+ . catch ( fail )
249251 . then ( done ) ;
250252 } ) ;
251253
@@ -280,27 +282,31 @@ describe('Test scattergeo hover', function() {
280282 Plotly . restyle ( gd , 'hoverinfo' , 'lon+lat+text+name' ) . then ( function ( ) {
281283 check ( [ 381 , 221 ] , [ '(10°, 10°)\nA' , 'trace 0' ] ) ;
282284 } )
285+ . catch ( fail )
283286 . then ( done ) ;
284287 } ) ;
285288
286289 it ( 'should generate hover label info (\'text\' single value case)' , function ( done ) {
287290 Plotly . restyle ( gd , 'text' , 'text' ) . then ( function ( ) {
288291 check ( [ 381 , 221 ] , [ '(10°, 10°)\ntext' , null ] ) ;
289292 } )
293+ . catch ( fail )
290294 . then ( done ) ;
291295 } ) ;
292296
293297 it ( 'should generate hover label info (\'hovertext\' single value case)' , function ( done ) {
294298 Plotly . restyle ( gd , 'hovertext' , 'hovertext' ) . then ( function ( ) {
295299 check ( [ 381 , 221 ] , [ '(10°, 10°)\nhovertext' , null ] ) ;
296300 } )
301+ . catch ( fail )
297302 . then ( done ) ;
298303 } ) ;
299304
300305 it ( 'should generate hover label info (\'hovertext\' array case)' , function ( done ) {
301306 Plotly . restyle ( gd , 'hovertext' , [ 'Apple' , 'Banana' , 'Orange' ] ) . then ( function ( ) {
302307 check ( [ 381 , 221 ] , [ '(10°, 10°)\nApple' , null ] ) ;
303308 } )
309+ . catch ( fail )
304310 . then ( done ) ;
305311 } ) ;
306312
@@ -318,13 +324,40 @@ describe('Test scattergeo hover', function() {
318324 fontFamily : 'Arial'
319325 } ) ;
320326 } )
327+ . catch ( fail )
321328 . then ( done ) ;
322329 } ) ;
323330
324331 it ( 'should generate hover label with arrayOk \'hoverinfo\' settings' , function ( done ) {
325332 Plotly . restyle ( gd , 'hoverinfo' , [ [ 'lon' , null , 'lat+name' ] ] ) . then ( function ( ) {
326333 check ( [ 381 , 221 ] , [ 'lon: 10°' , null ] ) ;
327334 } )
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 )
328361 . then ( done ) ;
329362 } ) ;
330363} ) ;
0 commit comments