@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
1414var MAPBOX_ACCESS_TOKEN = require ( '@build/credentials.json' ) . MAPBOX_ACCESS_TOKEN ;
1515var TRANSITION_DELAY = 500 ;
1616var MOUSE_DELAY = 100 ;
17+ var LONG_TIMEOUT_INTERVAL = 5 * jasmine . DEFAULT_TIMEOUT_INTERVAL ;
1718
1819var noop = function ( ) { } ;
1920
@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
204205 lat : [ 10 , 20 , 30 ]
205206 } ] ) ;
206207 } ) . toThrow ( new Error ( constants . noAccessTokenErrorMsg ) ) ;
207- } ) ;
208+ } , LONG_TIMEOUT_INTERVAL ) ;
208209
209210 it ( 'should throw error if token is invalid' , function ( done ) {
210211 var cnt = 0 ;
@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
215216 lat : [ 10 , 20 , 30 ]
216217 } ] , { } , {
217218 mapboxAccessToken : dummyToken
218- } ) . catch ( function ( err ) {
219+ } )
220+ . catch ( function ( err ) {
219221 cnt ++ ;
220222 expect ( err ) . toEqual ( new Error ( constants . mapOnErrorMsg ) ) ;
221- } ) . then ( function ( ) {
223+ } )
224+ . then ( function ( ) {
222225 expect ( cnt ) . toEqual ( 1 ) ;
223226 done ( ) ;
224227 } ) ;
225- } ) ;
228+ } , LONG_TIMEOUT_INTERVAL ) ;
226229
227230 it ( 'should use access token in mapbox layout options if present' , function ( done ) {
228231 var cnt = 0 ;
@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
244247 expect ( gd . _fullLayout . mapbox . accesstoken ) . toEqual ( MAPBOX_ACCESS_TOKEN ) ;
245248 done ( ) ;
246249 } ) ;
247- } ) ;
250+ } , LONG_TIMEOUT_INTERVAL ) ;
248251
249252 it ( 'should bypass access token in mapbox layout options when config points to an Atlas server' , function ( done ) {
250253 var cnt = 0 ;
@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
263266 }
264267 } , {
265268 mapboxAccessToken : ''
266- } ) . catch ( function ( err ) {
269+ } )
270+ . catch ( function ( err ) {
267271 cnt ++ ;
268272 expect ( err ) . toEqual ( new Error ( msg ) ) ;
269- } ) . then ( function ( ) {
273+ } )
274+ . then ( function ( ) {
270275 expect ( cnt ) . toEqual ( 1 ) ;
271276 done ( ) ;
272277 } ) ;
273- } ) ;
278+ } , LONG_TIMEOUT_INTERVAL ) ;
274279} ) ;
275280
276281describe ( 'mapbox plots' , function ( ) {
@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
310315 expect ( gd . _fullLayout . mapbox ) . toBeUndefined ( ) ;
311316
312317 return Plotly . restyle ( gd , 'visible' , true ) ;
313- } ) . then ( function ( ) {
318+ } )
319+ . then ( function ( ) {
314320 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 2 ) ;
315321
316322 return Plotly . restyle ( gd , 'visible' , 'legendonly' , [ 1 ] ) ;
317- } ) . then ( function ( ) {
323+ } )
324+ . then ( function ( ) {
318325 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 1 ) ;
319326
320327 return Plotly . restyle ( gd , 'visible' , true ) ;
321- } ) . then ( function ( ) {
328+ } )
329+ . then ( function ( ) {
322330 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 2 ) ;
323331
324332 var mockCopy = Lib . extendDeep ( { } , mock ) ;
325333 mockCopy . data [ 0 ] . visible = false ;
326334
327335 return Plotly . newPlot ( gd , mockCopy . data , mockCopy . layout ) ;
328- } ) . then ( function ( ) {
336+ } )
337+ . then ( function ( ) {
329338 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 1 ) ;
330339
331340 done ( ) ;
332341 } ) ;
333- } ) ;
342+ } , LONG_TIMEOUT_INTERVAL ) ;
334343
335344 it ( 'should be able to delete and add traces' , function ( done ) {
336345 var modes = [ 'line' , 'circle' ] ;
@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
348357 } ;
349358
350359 return Plotly . addTraces ( gd , [ trace ] ) ;
351- } ) . then ( function ( ) {
360+ } )
361+ . then ( function ( ) {
352362 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 2 ) ;
353363
354364 var trace = {
@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
359369 } ;
360370
361371 return Plotly . addTraces ( gd , [ trace ] ) ;
362- } ) . then ( function ( ) {
372+ } )
373+ . then ( function ( ) {
363374 expect ( countVisibleTraces ( gd , modes ) ) . toEqual ( 3 ) ;
364375
365376 return Plotly . deleteTraces ( gd , [ 0 , 1 , 2 ] ) ;
366- } ) . then ( function ( ) {
377+ } )
378+ . then ( function ( ) {
367379 expect ( gd . _fullLayout . mapbox ) . toBeUndefined ( ) ;
368380
369381 done ( ) ;
370382 } ) ;
371- } ) ;
383+ } , LONG_TIMEOUT_INTERVAL ) ;
372384
373385 it ( 'should be able to restyle' , function ( done ) {
374386 var restyleCnt = 0 ,
@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
425437 ] ) ;
426438 } )
427439 . then ( done ) ;
428- } ) ;
440+ } , LONG_TIMEOUT_INTERVAL ) ;
429441
430442 it ( 'should be able to relayout' , function ( done ) {
431443 var restyleCnt = 0 ,
@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
462474 assertLayout ( 'Mapbox Dark' , [ 0 , 0 ] , 1.234 , [ 80 , 100 , 908 , 270 ] ) ;
463475
464476 return Plotly . relayout ( gd , 'mapbox.zoom' , '6' ) ;
465- } ) . then ( function ( ) {
477+ } )
478+ . then ( function ( ) {
466479 expect ( restyleCnt ) . toEqual ( 0 ) ;
467480 expect ( relayoutCnt ) . toEqual ( 2 ) ;
468481
469482 assertLayout ( 'Mapbox Dark' , [ 0 , 0 ] , 6 , [ 80 , 100 , 908 , 270 ] ) ;
470483
471484 return Plotly . relayout ( gd , 'mapbox.style' , 'light' ) ;
472- } ) . then ( function ( ) {
485+ } )
486+ . then ( function ( ) {
473487 expect ( restyleCnt ) . toEqual ( 0 ) ;
474488 expect ( relayoutCnt ) . toEqual ( 3 ) ;
475489
476490 assertLayout ( 'Mapbox Light' , [ 0 , 0 ] , 6 , [ 80 , 100 , 908 , 270 ] ) ;
477491
478492 return Plotly . relayout ( gd , 'mapbox.domain.x' , [ 0 , 0.5 ] ) ;
479- } ) . then ( function ( ) {
493+ } )
494+ . then ( function ( ) {
480495 expect ( restyleCnt ) . toEqual ( 0 ) ;
481496 expect ( relayoutCnt ) . toEqual ( 4 ) ;
482497
483498 assertLayout ( 'Mapbox Light' , [ 0 , 0 ] , 6 , [ 80 , 100 , 454 , 270 ] ) ;
484499
485500 return Plotly . relayout ( gd , 'mapbox.domain.y[0]' , 0.5 ) ;
486- } ) . then ( function ( ) {
501+ } )
502+ . then ( function ( ) {
487503 expect ( restyleCnt ) . toEqual ( 0 ) ;
488504 expect ( relayoutCnt ) . toEqual ( 5 ) ;
489505
490506 assertLayout ( 'Mapbox Light' , [ 0 , 0 ] , 6 , [ 80 , 100 , 454 , 135 ] ) ;
491507
492508 done ( ) ;
493509 } ) ;
494- } ) ;
510+ } , LONG_TIMEOUT_INTERVAL ) ;
495511
496512 it ( 'should be able to add, update and remove layers' , function ( done ) {
497513 var mockWithLayers = require ( '@mocks/mapbox_layers' ) ;
@@ -623,7 +639,7 @@ describe('mapbox plots', function() {
623639
624640 done ( ) ;
625641 } ) ;
626- } ) ;
642+ } , LONG_TIMEOUT_INTERVAL ) ;
627643
628644 it ( 'should be able to update the access token' , function ( done ) {
629645 Plotly . relayout ( gd , 'mapbox.accesstoken' , 'wont-work' ) . catch ( function ( err ) {
@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
637653 expect ( gd . _promises . length ) . toEqual ( 0 ) ;
638654 done ( ) ;
639655 } ) ;
640- } ) ;
656+ } , LONG_TIMEOUT_INTERVAL ) ;
641657
642658 it ( 'should be able to update traces' , function ( done ) {
643659 function assertDataPts ( lengths ) {
@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
669685 } ;
670686
671687 return Plotly . extendTraces ( gd , update , [ 0 , 1 ] ) ;
672- } ) . then ( function ( ) {
688+ } )
689+ . then ( function ( ) {
673690 assertDataPts ( [ 5 , 5 ] ) ;
674691
675692 done ( ) ;
676693 } ) ;
677- } ) ;
694+ } , LONG_TIMEOUT_INTERVAL ) ;
678695
679696 it ( 'should display to hover labels on mouse over' , function ( done ) {
680697 function assertMouseMove ( pos , len ) {
@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
688705 assertMouseMove ( blankPos , 0 ) . then ( function ( ) {
689706 return assertMouseMove ( pointPos , 1 ) ;
690707 } ) . then ( done ) ;
691- } ) ;
708+ } , LONG_TIMEOUT_INTERVAL ) ;
692709
693710 it ( 'should respond to hover interactions by' , function ( done ) {
694711 var hoverCnt = 0 ,
@@ -736,7 +753,7 @@ describe('mapbox plots', function() {
736753
737754 done ( ) ;
738755 } ) ;
739- } ) ;
756+ } , LONG_TIMEOUT_INTERVAL ) ;
740757
741758 it ( 'should respond drag / scroll interactions' , function ( done ) {
742759 var relayoutCnt = 0 ,
@@ -795,7 +812,7 @@ describe('mapbox plots', function() {
795812
796813 // TODO test scroll
797814
798- } ) ;
815+ } , LONG_TIMEOUT_INTERVAL ) ;
799816
800817 it ( 'should respond to click interactions by' , function ( done ) {
801818 var ptData ;
@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
828845 } ) ;
829846 } )
830847 . then ( done ) ;
831- } ) ;
848+ } , LONG_TIMEOUT_INTERVAL ) ;
832849
833850 function getMapInfo ( gd ) {
834851 var subplot = gd . _fullLayout . mapbox . _subplot ,
0 commit comments