@@ -16,8 +16,9 @@ var customMatchers = require('../assets/custom_matchers');
16
16
*
17
17
*/
18
18
19
- var PLOT_DELAY = 100 ;
19
+ var PLOT_DELAY = 200 ;
20
20
var MOUSE_DELAY = 20 ;
21
+ var MODEBAR_DELAY = 500 ;
21
22
22
23
23
24
describe ( 'Test gl plot interactions' , function ( ) {
@@ -48,32 +49,40 @@ describe('Test gl plot interactions', function() {
48
49
destroyGraphDiv ( ) ;
49
50
} ) ;
50
51
52
+ function delay ( done ) {
53
+ setTimeout ( function ( ) {
54
+ done ( ) ;
55
+ } , PLOT_DELAY ) ;
56
+ }
51
57
52
58
describe ( 'gl3d plots' , function ( ) {
53
59
var mock = require ( '@mocks/gl3d_marker-arrays.json' ) ;
54
- var gd ;
55
60
56
61
function mouseEventScatter3d ( type , opts ) {
57
62
mouseEvent ( type , 605 , 271 , opts ) ;
58
63
}
59
64
60
65
beforeEach ( function ( done ) {
61
66
gd = createGraphDiv ( ) ;
62
- Plotly . plot ( gd , mock . data , mock . layout ) . then ( done ) ;
67
+ Plotly . plot ( gd , mock . data , mock . layout ) . then ( function ( ) {
68
+ delay ( done ) ;
69
+ } ) ;
63
70
} ) ;
64
71
65
72
describe ( 'scatter3d hover' , function ( ) {
73
+
66
74
var node , ptData ;
67
75
68
76
beforeEach ( function ( done ) {
69
77
gd . on ( 'plotly_hover' , function ( eventData ) {
70
78
ptData = eventData . points [ 0 ] ;
71
79
} ) ;
72
80
81
+ mouseEventScatter3d ( 'mouseover' ) ;
82
+
73
83
setTimeout ( function ( ) {
74
- mouseEventScatter3d ( 'mouseover' ) ;
75
- setTimeout ( done , MOUSE_DELAY ) ;
76
- } , PLOT_DELAY ) ;
84
+ done ( ) ;
85
+ } , MOUSE_DELAY ) ;
77
86
} ) ;
78
87
79
88
it ( 'should have' , function ( ) {
@@ -110,13 +119,13 @@ describe('Test gl plot interactions', function() {
110
119
ptData = eventData . points [ 0 ] ;
111
120
} ) ;
112
121
<
10000
code class="diff-text syntax-highlighted-line">
113
- setTimeout ( function ( ) {
122
+ // N.B. gl3d click events are 'mouseover' events
123
+ // with button 1 pressed
124
+ mouseEventScatter3d ( 'mouseover' , { buttons : 1 } ) ;
114
125
115
- // N.B. gl3d click events are 'mouseover' events
116
- // with button 1 pressed
117
- mouseEventScatter3d ( 'mouseover' , { buttons : 1 } ) ;
118
- setTimeout ( done , MOUSE_DELAY ) ;
119
- } , PLOT_DELAY ) ;
126
+ setTimeout ( function ( ) {
127
+ done ( ) ;
128
+ } , MOUSE_DELAY ) ;
120
129
} ) ;
121
130
122
131
it ( 'should have' , function ( ) {
@@ -139,7 +148,11 @@ describe('Test gl plot interactions', function() {
139
148
var mock = require ( '@mocks/gl2d_10.json' ) ;
140
149
141
150
beforeEach ( function ( done ) {
142
- Plotly . plot ( createGraphDiv ( ) , mock . data , mock . layout ) . then ( done ) ;
151
+ gd = createGraphDiv ( ) ;
152
+
153
+ Plotly . plot ( gd , mock . data , mock . layout ) . then ( function ( ) {
154
+ delay ( done ) ;
155
+ } ) ;
143
156
} ) ;
144
157
145
158
it ( 'has one *canvas* node' , function ( ) {
@@ -149,7 +162,7 @@ describe('Test gl plot interactions', function() {
149
162
} ) ;
150
163
151
164
describe ( 'gl3d modebar click handlers' , function ( ) {
152
- var gd , modeBar ;
165
+ var modeBar ;
153
166
154
167
beforeEach ( function ( done ) {
155
168
var mockData = [ {
@@ -166,7 +179,8 @@ describe('Test gl plot interactions', function() {
166
179
gd = createGraphDiv ( ) ;
167
180
Plotly . plot ( gd , mockData , mockLayout ) . then ( function ( ) {
168
181
modeBar = gd . _fullLayout . _modeBar ;
169
- done ( ) ;
182
+
183
+ delay ( done ) ;
170
184
} ) ;
171
185
} ) ;
172
186
@@ -249,9 +263,6 @@ describe('Test gl plot interactions', function() {
249
263
} ) ;
250
264
251
265
describe ( 'buttons resetCameraDefault3d and resetCameraLastSave3d' , function ( ) {
252
- // changes in scene objects are not instantaneous
253
- var DELAY = 500 ;
254
-
255
266
it ( 'should update the scene camera' , function ( done ) {
256
267
var sceneLayout = gd . _fullLayout . scene ,
257
268
sceneLayout2 = gd . _fullLayout . scene2 ,
@@ -286,8 +297,8 @@ describe('Test gl plot interactions', function() {
286
297
. toBeCloseToArray ( [ 2.5 , 2.5 , 2.5 ] , 4 ) ;
287
298
288
299
done ( ) ;
289
- } , DELAY ) ;
290
- } , DELAY ) ;
300
+ } , MODEBAR_DELAY ) ;
301
+ } , MODEBAR_DELAY ) ;
291
302
} ) ;
292
303
} ) ;
293
304
0 commit comments