@@ -4,7 +4,7 @@ var Plots = Plotly.Plots;
44
55var createGraphDiv = require ( '../assets/create_graph_div' ) ;
66var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7- var fail = require ( '../assets/fail_test' ) ;
7+ var failTest = require ( '../assets/fail_test' ) ;
88var delay = require ( '../assets/delay' ) ;
99
1010var mock = require ( '@mocks/animation' ) ;
@@ -174,19 +174,19 @@ describe('Test animate API', function() {
174174
175175 // traces are [0, 1]:
176176 expect ( args [ 3 ] ) . toEqual ( [ 0 , 1 ] ) ;
177- } ) . catch ( fail ) . then ( done ) ;
177+ } ) . catch ( failTest ) . then ( done ) ;
178178 } ) ;
179179
180180 it ( 'rejects if a frame is not found' , function ( done ) {
181- Plotly . animate ( gd , [ 'foobar' ] , animOpts ) . then ( fail ) . then ( done , done ) ;
181+ Plotly . animate ( gd , [ 'foobar' ] , animOpts ) . then ( failTest ) . then ( done , done ) ;
182182 } ) ;
183183
184184 it ( 'treats objects as frames' , function ( done ) {
185185 var frame = { data : [ { x : [ 1 , 2 , 3 ] } ] } ;
186186 Plotly . animate ( gd , frame , animOpts ) . then ( function ( ) {
187187 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 1 ) ;
188188 verifyQueueEmpty ( gd ) ;
189- } ) . catch ( fail ) . then ( done ) ;
189+ } ) . catch ( failTest ) . then ( done ) ;
190190 } ) ;
191191
192192 it ( 'treats a list of objects as frames' , function ( done ) {
@@ -203,64 +203,64 @@ describe('Test animate API', function() {
203203
204204 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 2 ) ;
205205 verifyQueueEmpty ( gd ) ;
206- } ) . catch ( fail ) . then ( done ) ;
206+ } ) . catch ( failTest ) . then ( done ) ;
207207 } ) ;
208208
209209 it ( 'animates all frames if list is null' , function ( done ) {
210210 Plotly . animate ( gd , null , animOpts ) . then ( function ( ) {
211211 verifyFrameTransitionOrder ( gd , [ 'base' , 'frame0' , 'frame1' , 'frame2' , 'frame3' ] ) ;
212212 verifyQueueEmpty ( gd ) ;
213- } ) . catch ( fail ) . then ( done ) ;
213+ } ) . catch ( failTest ) . then ( done ) ;
214214 } ) ;
215215
216216 it ( 'animates all frames if list is undefined' , function ( done ) {
217217 Plotly . animate ( gd , undefined , animOpts ) . then ( function ( ) {
218218 verifyFrameTransitionOrder ( gd , [ 'base' , 'frame0' , 'frame1' , 'frame2' , 'frame3' ] ) ;
219219 verifyQueueEmpty ( gd ) ;
220- } ) . catch ( fail ) . then ( done ) ;
220+ } ) . catch ( failTest ) . then ( done ) ;
221221 } ) ;
222222
223223 it ( 'animates to a single frame' , function ( done ) {
224224 Plotly . animate ( gd , [ 'frame0' ] , animOpts ) . then ( function ( ) {
225225 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 1 ) ;
226226 verifyQueueEmpty ( gd ) ;
227- } ) . catch ( fail ) . then ( done ) ;
227+ } ) . catch ( failTest ) . then ( done ) ;
228228 } ) ;
229229
230230 it ( 'animates to an empty list' , function ( done ) {
231231 Plotly . animate ( gd , [ ] , animOpts ) . then ( function ( ) {
232232 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 0 ) ;
233233 verifyQueueEmpty ( gd ) ;
234- } ) . catch ( fail ) . then ( done ) ;
234+ } ) . catch ( failTest ) . then ( done ) ;
235235 } ) ;
236236
237237 it ( 'animates to a list of frames' , function ( done ) {
238238 Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , animOpts ) . then ( function ( ) {
239239 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 2 ) ;
240240 verifyQueueEmpty ( gd ) ;
241- } ) . catch ( fail ) . then ( done ) ;
241+ } ) . catch ( failTest ) . then ( done ) ;
242242 } ) ;
243243
244244 it ( 'animates frames by group' , function ( done ) {
245245 Plotly . animate ( gd , 'even-frames' , animOpts ) . then ( function ( ) {
246246 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 2 ) ;
247247 verifyQueueEmpty ( gd ) ;
248- } ) . catch ( fail ) . then ( done ) ;
248+ } ) . catch ( failTest ) . then ( done ) ;
249249 } ) ;
250250
251251 it ( 'animates frames in the correct order' , function ( done ) {
252252 Plotly . animate ( gd , [ 'frame0' , 'frame2' , 'frame1' , 'frame3' ] , animOpts ) . then ( function ( ) {
253253 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' , 'frame1' , 'frame3' ] ) ;
254254 verifyQueueEmpty ( gd ) ;
255- } ) . catch ( fail ) . then ( done ) ;
255+ } ) . catch ( failTest ) . then ( done ) ;
256256 } ) ;
257257
258258 it ( 'accepts a single animationOpts' , function ( done ) {
259259 Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , { transition : { duration : 1.12345 } } ) . then ( function ( ) {
260260 var calls = Plots . transition . calls ;
261261 expect ( calls . argsFor ( 0 ) [ 5 ] . duration ) . toEqual ( 1.12345 ) ;
262262 expect ( calls . argsFor ( 1 ) [ 5 ] . duration ) . toEqual ( 1.12345 ) ;
263- } ) . catch ( fail ) . then ( done ) ;
263+ } ) . catch ( failTest ) . then ( done ) ;
264264 } ) ;
265265
266266 it ( 'accepts an array of animationOpts' , function ( done ) {
@@ -273,7 +273,7 @@ describe('Test animate API', function() {
273273 expect ( calls . argsFor ( 1 ) [ 4 ] . duration ) . toEqual ( 5.4321 ) ;
274274 expect ( calls . argsFor ( 0 ) [ 5 ] . duration ) . toEqual ( 1.123 ) ;
275275 expect ( calls . argsFor ( 1 ) [ 5 ] . duration ) . toEqual ( 1.456 ) ;
276- } ) . catch ( fail ) . then ( done ) ;
276+ } ) . catch ( failTest ) . then ( done ) ;
277277 } ) ;
278278
279279 it ( 'falls back to animationOpts[0] if not enough supplied in array' , function ( done ) {
@@ -286,7 +286,7 @@ describe('Test animate API', function() {
286286 expect ( calls . argsFor ( 1 ) [ 4 ] . duration ) . toEqual ( 2.345 ) ;
287287 expect ( calls . argsFor ( 0 ) [ 5 ] . duration ) . toEqual ( 1.123 ) ;
288288 expect ( calls . argsFor ( 1 ) [ 5 ] . duration ) . toEqual ( 1.123 ) ;
289- } ) . catch ( fail ) . then ( done ) ;
289+ } ) . catch ( failTest ) . then ( done ) ;
290290 } ) ;
291291
292292 it ( 'chains animations as promises' , function ( done ) {
@@ -295,7 +295,7 @@ describe('Test animate API', function() {
295295 } ) . then ( function ( ) {
296296 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame1' , 'frame2' , 'frame3' ] ) ;
297297 verifyQueueEmpty ( gd ) ;
298- } ) . catch ( fail ) . then ( done ) ;
298+ } ) . catch ( failTest ) . then ( done ) ;
299299 } ) ;
300300
301301 it ( 'emits plotly_animated before the promise is resolved' , function ( done ) {
@@ -306,7 +306,7 @@ describe('Test animate API', function() {
306306
307307 Plotly . animate ( gd , [ 'frame0' ] , animOpts ) . then ( function ( ) {
308308 expect ( animated ) . toBe ( true ) ;
309- } ) . catch ( fail ) . then ( done ) ;
309+ } ) . catch ( failTest ) . then ( done ) ;
310310 } ) ;
311311
312312 it ( 'emits plotly_animated as each animation in a sequence completes' , function ( done ) {
@@ -332,7 +332,7 @@ describe('Test animate API', function() {
332332 } ) . then ( function ( ) {
333333 expect ( test1 ) . toBe ( 1 ) ;
334334 expect ( test2 ) . toBe ( 1 ) ;
335- } ) . catch ( fail ) . then ( done ) ;
335+ } ) . catch ( failTest ) . then ( done ) ;
336336 } ) ;
337337
338338 it ( 'resolves at the end of each animation sequence' , function ( done ) {
@@ -341,7 +341,7 @@ describe('Test animate API', function() {
341341 } ) . then ( function ( ) {
342342 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' , 'frame0' , 'frame2' , 'frame1' , 'frame3' ] ) ;
343343 verifyQueueEmpty ( gd ) ;
344- } ) . catch ( fail ) . then ( done ) ;
344+ } ) . catch ( failTest ) . then ( done ) ;
345345 } ) ;
346346 } ) ;
347347 }
@@ -362,15 +362,15 @@ describe('Test animate API', function() {
362362 Plotly . animate ( gd , [ 'frame0' , 'frame2' , 'frame1' , 'frame3' ] , animOpts ) . then ( function ( ) {
363363 verifyFrameTransitionOrder ( gd , [ 'frame3' , 'frame1' , 'frame2' , 'frame0' ] ) ;
364364 verifyQueueEmpty ( gd ) ;
365- } ) . catch ( fail ) . then ( done ) ;
365+ } ) . catch ( failTest ) . then ( done ) ;
366366 } ) ;
367367
368368 it ( 'animates a group in reverse' , function ( done ) {
369369 animOpts . direction = 'reverse' ;
370370 Plotly . animate ( gd , 'even-frames' , animOpts ) . then ( function ( ) {
371371 verifyFrameTransitionOrder ( gd , [ 'frame2' , 'frame0' ] ) ;
372372 verifyQueueEmpty ( gd ) ;
373- } ) . catch ( fail ) . then ( done ) ;
373+ } ) . catch ( failTest ) . then ( done ) ;
374374 } ) ;
375375 } ) ;
376376
@@ -394,7 +394,7 @@ describe('Test animate API', function() {
394394 } ) . then ( function ( ) {
395395 verifyFrameTransitionOrder ( gd , [ 'frame1' , 'frame2' , 'frame3' ] ) ;
396396 verifyQueueEmpty ( gd ) ;
397- } ) . catch ( fail ) . then ( done ) ;
397+ } ) . catch ( failTest ) . then ( done ) ;
398398 } ) ;
399399
400400 it ( 'plays from the start when current frame = last frame' , function ( done ) {
@@ -410,7 +410,7 @@ describe('Test animate API', function() {
410410 ] ) ;
411411
412412 verifyQueueEmpty ( gd ) ;
413- } ) . catch ( fail ) . then ( done ) ;
413+ } ) . catch ( failTest ) . then ( done ) ;
414414 } ) ;
415415
416416 it ( 'animates in reverse starting at the current frame' , function ( done ) {
@@ -423,7 +423,7 @@ describe('Test animate API', function() {
423423 } ) . then ( function ( ) {
424424 verifyFrameTransitionOrder ( gd , [ 'frame1' , 'frame0' , 'base' ] ) ;
425425 verifyQueueEmpty ( gd ) ;
426- } ) . catch ( fail ) . then ( done ) ;
426+ } ) . catch ( failTest ) . then ( done ) ;
427427 } ) ;
428428
429429 it ( 'plays in reverse from the end when current frame = first frame' , function ( done ) {
@@ -440,7 +440,7 @@ describe('Test animate API', function() {
440440 ] ) ;
441441
442442 verifyQueueEmpty ( gd ) ;
443- } ) . catch ( fail ) . then ( done ) ;
443+ } ) . catch ( failTest ) . then ( done ) ;
444444 } ) ;
445445 } ) ;
446446
@@ -467,7 +467,7 @@ describe('Test animate API', function() {
467467 Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
468468 expect ( interrupted ) . toBe ( true ) ;
469469 verifyQueueEmpty ( gd ) ;
470- } ) . catch ( fail ) . then ( done ) ;
470+ } ) . catch ( failTest ) . then ( done ) ;
471471 } ) ;
472472
473473 it ( 'queues successive animations' , function ( done ) {
@@ -486,52 +486,52 @@ describe('Test animate API', function() {
486486 Plotly . animate ( gd , 'odd-frames' , { transition : { duration : 16 } } ) . then ( delay ( 10 ) ) . then ( function ( ) {
487487 expect ( ends ) . toEqual ( 1 ) ;
488488 verifyQueueEmpty ( gd ) ;
489- } ) . catch ( fail ) . then ( done ) ;
489+ } ) . catch ( failTest ) . then ( done ) ;
490490 } ) ;
491491
492492 it ( 'an empty list with immediate dumps previous frames' , function ( done ) {
493493 Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , { frame : { duration : 50 } } ) ;
494494 Plotly . animate ( gd , [ ] , { mode : 'immediate' } ) . then ( function ( ) {
495495 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 1 ) ;
496496 verifyQueueEmpty ( gd ) ;
497- } ) . catch ( fail ) . then ( done ) ;
497+ } ) . catch ( failTest ) . then ( done ) ;
498498 } ) ;
499499
500500 it ( 'animates groups in the correct order' , function ( done ) {
501501 Plotly . animate ( gd , 'even-frames' , animOpts ) ;
502502 Plotly . animate ( gd , 'odd-frames' , animOpts ) . then ( function ( ) {
503503 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' , 'frame1' , 'frame3' ] ) ;
504504 verifyQueueEmpty ( gd ) ;
505- } ) . catch ( fail ) . then ( done ) ;
505+ } ) . catch ( failTest ) . then ( done ) ;
506506 } ) ;
507507
508508 it ( 'drops queued frames when immediate = true' , function ( done ) {
509509 Plotly . animate ( gd , 'even-frames' , animOpts ) ;
510510 Plotly . animate ( gd , 'odd-frames' , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
511511 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame1' , 'frame3' ] ) ;
512512 verifyQueueEmpty ( gd ) ;
513- } ) . catch ( fail ) . then ( done ) ;
513+ } ) . catch ( failTest ) . then ( done ) ;
514514 } ) ;
515515
516516 it ( 'animates frames and groups in sequence' , function ( done ) {
517517 Plotly . animate ( gd , 'even-frames' , animOpts ) ;
518518 Plotly . animate ( gd , [ 'frame0' , 'frame2' , 'frame1' , 'frame3' ] , animOpts ) . then ( function ( ) {
519519 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' , 'frame0' , 'frame2' , 'frame1' , 'frame3' ] ) ;
520520 verifyQueueEmpty ( gd ) ;
521- } ) . catch ( fail ) . then ( done ) ;
521+ } ) . catch ( failTest ) . then ( done ) ;
522522 } ) ;
523523
524524 it ( 'rejects when an animation is interrupted' , function ( done ) {
525525 var interrupted = false ;
526- Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , animOpts ) . then ( fail , function ( ) {
526+ Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , animOpts ) . then ( failTest , function ( ) {
527527 interrupted = true ;
528528 } ) ;
529529
530530 Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
531531 expect ( interrupted ) . toBe ( true ) ;
532532 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' ] ) ;
533533 verifyQueueEmpty ( gd ) ;
534- } ) . catch ( fail ) . then ( done ) ;
534+ } ) . catch ( failTest ) . then ( done ) ;
535535 } ) ;
536536 } ) ;
537537
@@ -550,7 +550,7 @@ describe('Test animate API', function() {
550550 frame : { duration : 1 }
551551 } ) . then ( function ( ) {
552552 expect ( frames ) . toEqual ( [ 'frame0' , 'frame1' , null , null ] ) ;
553- } ) . catch ( fail ) . then ( done ) ;
553+ } ) . catch ( failTest ) . then ( done ) ;
554554
555555 } ) ;
556556 } ) ;
@@ -567,7 +567,7 @@ describe('Test animate API', function() {
567567 // Transition timing:
568568 expect ( Plots . transition . calls . argsFor ( 0 ) [ 5 ] . duration ) . toEqual ( 50 ) ;
569569
570- } ) . catch ( fail ) . then ( done ) ;
570+ } ) . catch ( failTest ) . then ( done ) ;
571571 } ) ;
572572
573573 it ( 'limits the transition duration to <= frame duration (matching per-config)' , function ( done ) {
@@ -583,7 +583,7 @@ describe('Test animate API', function() {
583583 expect ( Plots . transition . calls . argsFor ( 0 ) [ 5 ] . duration ) . toEqual ( 50 ) ;
584584 expect ( Plots . transition . calls . argsFor ( 1 ) [ 5 ] . duration ) . toEqual ( 40 ) ;
585585
586- } ) . catch ( fail ) . then ( done ) ;
586+ } ) . catch ( failTest ) . then ( done ) ;
587587 } ) ;
588588 } ) ;
589589} ) ;
@@ -615,7 +615,7 @@ describe('Animate API details', function() {
615615 { frame : { redraw : true , duration : dur } , transition : { duration : dur } }
616616 ) . then ( function ( ) {
617617 expect ( redraws ) . toBe ( 1 ) ;
618- } ) . catch ( fail ) . then ( done ) ;
618+ } ) . catch ( failTest ) . then ( done ) ;
619619 } ) ;
620620
621621 it ( 'forces a relayout after layout animations' , function ( done ) {
@@ -633,7 +633,7 @@ describe('Animate API details', function() {
633633 expect ( relayouts ) . toBe ( 1 ) ;
634634 expect ( restyles ) . toBe ( 0 ) ;
635635 expect ( redraws ) . toBe ( 0 ) ;
636- } ) . catch ( fail ) . then ( done ) ;
636+ } ) . catch ( failTest ) . then ( done ) ;
637637 } ) ;
638638
639639 it ( 'triggers plotly_animated after a single layout animation' , function ( done ) {
@@ -679,7 +679,7 @@ describe('Animate API details', function() {
679679 } ) . then ( function ( ) {
680680 // Confirm the result:
681681 expect ( gd . data [ 0 ] . x ) . toEqual ( [ 8 , 7 , 6 ] ) ;
682- } ) . catch ( fail ) . then ( done ) ;
682+ } ) . catch ( failTest ) . then ( done ) ;
683683 } ) ;
684684
685685 it ( 'ignores null and undefined frames' , function ( done ) {
@@ -694,7 +694,7 @@ describe('Animate API details', function() {
694694
695695 // Check unused frames did not affect the current frame:
696696 expect ( gd . _fullLayout . _currentFrame ) . toEqual ( 'frame0' ) ;
697- } ) . catch ( fail ) . then ( done ) ;
697+ } ) . catch ( failTest ) . then ( done ) ;
698698 } ) ;
699699
700700 it ( 'null frames should not break everything' , function ( done ) {
@@ -703,7 +703,7 @@ describe('Animate API details', function() {
703703 Plotly . animate ( gd , null , {
704704 frame : { duration : 0 } ,
705705 transition : { duration : 0 }
706- } ) . catch ( fail ) . then ( done ) ;
706+ } ) . catch ( failTest ) . then ( done ) ;
707707 } ) ;
708708} ) ;
709709
@@ -747,7 +747,7 @@ describe('Animating multiple axes', function() {
747747 expect ( gd . _fullLayout . yaxis . range ) . toEqual ( [ 2 , 3 ] ) ;
748748 expect ( gd . _fullLayout . yaxis2 . range ) . toEqual ( [ 1 , 2 ] ) ;
749749 } )
750- . catch ( fail )
750+ . catch ( failTest )
751751 . then ( done ) ;
752752 } ) ;
753753} ) ;
@@ -778,7 +778,7 @@ describe('non-animatable fallback', function() {
778778 } ] , { frame : { duration : 0 } } ) ;
779779 } ) . then ( function ( ) {
780780 expect ( gd . data [ 0 ] . y ) . toEqual ( [ 6 , 4 , 5 ] ) ;
781- } ) . catch ( fail ) . then ( done ) ;
781+ } ) . catch ( failTest ) . then ( done ) ;
782782
783783 } ) ;
784784} ) ;
@@ -812,7 +812,7 @@ describe('animating scatter traces', function() {
812812 } ] , { transition : { duration : 0 } , frame : { duration : 0 , redraw : false } } ) ;
813813 } ) . then ( function ( ) {
814814 expect ( trace . node ( ) . style . opacity ) . toEqual ( '0.1' ) ;
815- } ) . catch ( fail ) . then ( done ) ;
815+ } ) . catch ( failTest ) . then ( done ) ;
816816 } ) ;
817817
818818 it ( 'computes calcdata correctly when transforms are present' , function ( done ) {
@@ -834,6 +834,6 @@ describe('animating scatter traces', function() {
834834 return Plotly . animate ( gd , [ 'frame2' ] , { frame : { duration : 200 , redraw : false } } ) ;
835835 } ) . then ( function ( ) {
836836 expect ( gd . calcdata [ 0 ] [ 0 ] . y ) . toEqual ( 3 ) ;
837- } ) . catch ( fail ) . then ( done ) ;
837+ } ) . catch ( failTest ) . then ( done ) ;
838838 } ) ;
839839} ) ;
0 commit comments