@@ -36,8 +36,9 @@ describe('Test animate API', function() {
3636 mockCopy = Lib . extendDeep ( { } , mock ) ;
3737
3838 spyOn ( Plots , 'transition' ) . and . callFake ( function ( ) {
39- // Transition's fake behaviro is to resolve after a short period of time:
40- return Promise . resolve ( ) . then ( delay ( 5 ) ) ;
39+ // Transition's fake behavior is just to delay by the duration
40+ // and resolve:
41+ return Promise . resolve ( ) . then ( delay ( arguments [ 5 ] . duration ) ) ;
4142 } ) ;
4243
4344 Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
@@ -280,7 +281,7 @@ describe('Test animate API', function() {
280281
281282 Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , animOpts ) ;
282283
283- Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { immediate : true } ) ) . then ( function ( ) {
284+ Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
284285 expect ( interrupted ) . toBe ( true ) ;
285286 verifyQueueEmpty ( gd ) ;
286287 } ) . catch ( fail ) . then ( done ) ;
@@ -307,7 +308,7 @@ describe('Test animate API', function() {
307308
308309 it ( 'an empty list with immediate dumps previous frames' , function ( done ) {
309310 Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , { frame : { duration : 50 } } ) ;
310- Plotly . animate ( gd , [ ] , { immediate : true } ) . then ( function ( ) {
311+ Plotly . animate ( gd , [ ] , { mode : 'immediate' } ) . then ( function ( ) {
311312 expect ( Plots . transition . calls . count ( ) ) . toEqual ( 1 ) ;
312313 verifyQueueEmpty ( gd ) ;
313314 } ) . catch ( fail ) . then ( done ) ;
@@ -323,7 +324,7 @@ describe('Test animate API', function() {
323324
324325 it ( 'drops queued frames when immediate = true' , function ( done ) {
325326 Plotly . animate ( gd , 'even-frames' , animOpts ) ;
326- Plotly . animate ( gd , 'odd-frames' , Lib . extendFlat ( animOpts , { immediate : true } ) ) . then ( function ( ) {
327+ Plotly . animate ( gd , 'odd-frames' , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
327328 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame1' , 'frame3' ] ) ;
328329 verifyQueueEmpty ( gd ) ;
329330 } ) . catch ( fail ) . then ( done ) ;
@@ -343,29 +344,11 @@ describe('Test animate API', function() {
343344 interrupted = true ;
344345 } ) ;
345346
346- Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { immediate : true } ) ) . then ( function ( ) {
347+ Plotly . animate ( gd , [ 'frame2' ] , Lib . extendFlat ( animOpts , { mode : 'immediate' } ) ) . then ( function ( ) {
347348 expect ( interrupted ) . toBe ( true ) ;
348349 verifyFrameTransitionOrder ( gd , [ 'frame0' , 'frame2' ] ) ;
349350 verifyQueueEmpty ( gd ) ;
350351 } ) . catch ( fail ) . then ( done ) ;
351352 } ) ;
352353 } ) ;
353-
354- it ( 'animates reasonably even when transition duration >> frame duration' , function ( done ) {
355- var starts = 0 ;
356- var ends = 0 ;
357-
358- gd . on ( 'plotly_animating' , function ( ) {
359- starts ++ ;
360- } ) . on ( 'plotly_animated' , function ( ) {
361- ends ++ ;
362- } ) ;
363-
364- Plotly . animate ( gd , [ 'frame0' , 'frame1' ] , { transition : { duration : 200 } , frame : { duration : 20 } } ) . then ( function ( ) {
365- expect ( starts ) . toEqual ( 1 ) ;
366- expect ( ends ) . toEqual ( 1 ) ;
367- expect ( Plots . transition . calls . count ( ) ) . toEqual ( 2 ) ;
368- verifyQueueEmpty ( gd ) ;
369- } ) . catch ( fail ) . then ( done ) ;
370- } ) ;
371354} ) ;
0 commit comments