@@ -12,32 +12,31 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
12
12
var delay = require ( '../assets/delay' ) ;
13
13
var mock = require ( '@mocks/animation' ) ;
14
14
15
- [ 0 , 20 ] . forEach ( function ( transitionDuration ) {
16
- // Run the whole set of tests twice: once with zero duration and once with
17
- // nonzero duration since the behavior should be identical, but there's a
18
- // very real possibility of race conditions or other timing issues.
19
- //
20
- // And of course, remember to put the async loop in a closure:
15
+ describe ( 'Plots.transition' , function ( ) {
16
+ 'use strict' ;
21
17
22
- describe ( 'Plots.transition (duration = ' + transitionDuration + ')' , function ( ) {
23
- 'use strict' ;
24
-
25
- var gd ;
18
+ var gd ;
26
19
27
- beforeEach ( function ( done ) {
28
- gd = createGraphDiv ( ) ;
20
+ beforeEach ( function ( done ) {
21
+ gd = createGraphDiv ( ) ;
29
22
30
- var mockCopy = Lib . extendDeep ( { } , mock ) ;
23
+ var mockCopy = Lib . extendDeep ( { } , mock ) ;
31
24
32
- Plotly . newPlot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
33
- } ) ;
25
+ Plotly . newPlot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
26
+ } ) ;
34
27
35
- afterEach ( function ( ) {
36
- Plotly . purge ( gd ) ;
37
- destroyGraphDiv ( ) ;
38
- } ) ;
28
+ afterEach ( function ( ) {
29
+ Plotly . purge ( gd ) ;
30
+ destroyGraphDiv ( ) ;
31
+ } ) ;
39
32
40
- it ( 'resolves only once the transition has completed' , function ( done ) {
33
+ // Run the whole set of tests twice: once with zero duration and once with
34
+ // nonzero duration since the behavior should be identical, but there's a
35
+ // very real possibility of race conditions or other timing issues.
36
+ //
37
+ // And of course, remember to put the async loop in a closure:
38
+ [ 0 , 20 ] . forEach ( function ( transitionDuration ) {
39
+ it ( 'with duration:' + transitionDuration + ', resolves only once the transition has completed' , function ( done ) {
41
40
var t1 = Date . now ( ) ;
42
41
var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
43
42
@@ -48,7 +47,7 @@ var mock = require('@mocks/animation');
48
47
} ) . then ( done , done . fail ) ;
49
48
} ) ;
50
49
51
- it ( 'emits plotly_transitioning on transition start' , function ( done ) {
50
+ it ( 'with duration:' + transitionDuration + ', emits plotly_transitioning on transition start', function ( done ) {
52
51
var beginTransitionCnt = 0 ;
53
52
var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
54
53
@@ -61,7 +60,7 @@ var mock = require('@mocks/animation');
61
60
} ) . then ( done , done . fail ) ;
62
61
} ) ;
63
62
64
- it ( 'emits plotly_transitioned on transition end' , function ( done ) {
63
+ it ( 'with duration:' + transitionDuration + ', emits plotly_transitioned on transition end', function ( done ) {
65
64
var trEndCnt = 0 ;
66
65
var traces = plotApiHelpers . coerceTraceIndices ( gd , null ) ;
67
66
@@ -74,7 +73,7 @@ var mock = require('@mocks/animation');
74
73
} ) . then ( done , done . fail ) ;
75
74
} ) ;
76
75
77
- it ( 'transitions an annotation' , function ( done ) {
76
+ it ( 'with duration:' + transitionDuration + ', transitions an annotation', function ( done ) {
78
77
function annotationPosition ( ) {
79
78
var g = gd . _fullLayout . _infolayer . select ( '.annotation' ) . select ( '.annotation-text-g' ) ;
80
79
var bBox = g . node ( ) . getBoundingClientRect ( ) ;
@@ -102,7 +101,7 @@ var mock = require('@mocks/animation');
102
101
} ) . then ( done , done . fail ) ;
103
102
} ) ;
104
103
105
- it ( 'transitions an image' , function ( done ) {
104
+ it ( 'with duration:' + transitionDuration + ', transitions an image', function ( done ) {
106
105
var jsLogo = 'https://images.plot.ly/language-icons/api-home/js-logo.png' ;
107
106
var pythonLogo = 'https://images.plot.ly/language-icons/api-home/python-logo.png' ;
108
107
@@ -137,7 +136,7 @@ var mock = require('@mocks/animation');
137
136
} ) . then ( done , done . fail ) ;
138
137
} ) ;
139
138
140
- it ( 'transitions a shape' , function ( done ) {
139
+ it ( 'with duration:' + transitionDuration + ', transitions a shape', function ( done ) {
141
140
function getPath ( ) {
142
141
return gd . _fullLayout . _shapeUpperLayer . select ( 'path' ) . node ( ) ;
143
142
}
@@ -195,7 +194,7 @@ var mock = require('@mocks/animation');
195
194
} ) ;
196
195
197
196
198
- it ( 'transitions a transform' , function ( done ) {
197
+ it ( 'with duration:' + transitionDuration + ', transitions a transform', function ( done ) {
199
198
Plotly . restyle ( gd , {
200
199
'transforms[0]' : {
201
200
enabled : true ,
@@ -232,7 +231,7 @@ var mock = require('@mocks/animation');
232
231
233
232
// This doesn't really test anything that the above tests don't cover, but it combines
234
233
// the behavior and attempts to ensure chaining and events happen in the correct order.
235
- it ( 'transitions may be chained' , function ( done ) {
234
+ it ( 'with duration:' + transitionDuration + ', transitions may be chained', function ( done ) {
236
235
var currentlyRunning = 0 ;
237
236
var beginCnt = 0 ;
238
237
var endCnt = 0 ;
0 commit comments