1
1
var Plotly = require ( '@lib/index' ) ;
2
2
var Lib = require ( '@src/lib' ) ;
3
3
var Plots = Plotly . Plots ;
4
+ var plotApiHelpers = require ( '@src/plot_api/helpers' ) ;
4
5
5
6
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
6
7
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -29,8 +30,9 @@ function runTests(transitionDuration) {
29
30
30
31
it ( 'resolves only once the transition has completed' , function ( done ) {
31
32
var t1 = Date . now ( ) ;
33
+ var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
32
34
33
- Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , null , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
35
+ Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , traces , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
34
36
. then ( delay ( 20 ) )
35
37
. then ( function ( ) {
36
38
expect ( Date . now ( ) - t1 ) . toBeGreaterThan ( transitionDuration ) ;
@@ -39,9 +41,11 @@ function runTests(transitionDuration) {
39
41
40
42
it ( 'emits plotly_transitioning on transition start' , function ( done ) {
41
43
var beginTransitionCnt = 0 ;
44
+ var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
45
+
42
46
gd . on ( 'plotly_transitioning' , function ( ) { beginTransitionCnt ++ ; } ) ;
43
47
44
- Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , null , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
48
+ Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , traces , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
45
49
. then ( delay ( 20 ) )
46
50
. then ( function ( ) {
47
51
expect ( beginTransitionCnt ) . toBe ( 1 ) ;
@@ -50,9 +54,11 @@ function runTests(transitionDuration) {
50
54
51
55
it ( 'emits plotly_transitioned on transition end' , function ( done ) {
52
56
var trEndCnt = 0 ;
57
+ var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
58
+
53
59
gd . on ( 'plotly_transitioned' , function ( ) { trEndCnt ++ ; } ) ;
54
60
55
- Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , null , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
61
+ Plots . transition ( gd , null , { 'xaxis.range' : [ 0.2 , 0.3 ] } , traces , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } )
56
62
. then ( delay ( 20 ) )
57
63
. then ( function ( ) {
58
64
expect ( trEndCnt ) . toEqual ( 1 ) ;
@@ -70,7 +76,8 @@ function runTests(transitionDuration) {
70
76
gd . on ( 'plotly_transitioned' , function ( ) { currentlyRunning -- ; endCnt ++ ; } ) ;
71
77
72
78
function doTransition ( ) {
73
- return Plots . transition ( gd , [ { x : [ 1 , 2 ] } ] , null , null , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } ) ;
79
+ var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
80
+ return Plots . transition ( gd , [ { x : [ 1 , 2 ] } ] , null , traces , { redraw : true } , { duration : transitionDuration , easing : 'cubic-in-out' } ) ;
74
81
}
75
82
76
83
function checkNoneRunning ( ) {
0 commit comments