@@ -2,7 +2,7 @@ var d3 = require('d3');
2
2
3
3
var Plotly = require ( '@lib/index' ) ;
4
4
var Lib = require ( '@src/lib' ) ;
5
- var DBLCLICKDELAY = require ( '@src/plots/cartesian/constants' ) . DBLCLICKDELAY ;
5
+ var doubleClick = require ( '../assets/double_click' ) ;
6
6
7
7
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
8
8
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -35,23 +35,6 @@ describe('select box and lasso', function() {
35
35
mouseEvent ( 'mouseup' , path [ len - 1 ] [ 0 ] , path [ len - 1 ] [ 1 ] ) ;
36
36
}
37
37
38
- // cartesian click events events use the hover data
39
- // from the mousemove events and then simulate
40
- // a click event on mouseup
41
- function click ( x , y ) {
42
- mouseEvent ( 'mousemove' , x , y ) ;
43
- mouseEvent ( 'mousedown' , x , y ) ;
44
- mouseEvent ( 'mouseup' , x , y ) ;
45
- }
46
-
47
- function doubleClick ( x , y , cb ) {
48
- click ( x , y ) ;
49
- setTimeout ( function ( ) {
50
- click ( x , y ) ;
51
- cb ( ) ;
52
- } , DBLCLICKDELAY / 2 ) ;
53
- }
54
-
55
38
function assertRange ( actual , expected ) {
56
39
var PRECISION = 4 ;
57
40
@@ -104,7 +87,7 @@ describe('select box and lasso', function() {
104
87
105
88
drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
106
89
107
- doubleClick ( x2 , y2 , done ) ;
90
+ doubleClick ( x2 , y2 ) . then ( done ) ;
108
91
} ) ;
109
92
} ) ;
110
93
@@ -153,7 +136,7 @@ describe('select box and lasso', function() {
153
136
154
137
drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
155
138
156
- doubleClick ( x2 , y2 , done ) ;
139
+ doubleClick ( x2 , y2 ) . then ( done ) ;
157
140
} ) ;
158
141
} ) ;
159
142
@@ -225,7 +208,7 @@ describe('select box and lasso', function() {
225
208
y : [ 0.10209191961595454 , 24.512223978291406 ]
226
209
} , 'with the correct selected range' ) ;
227
210
228
- doubleClick ( 250 , 200 , function ( ) {
211
+ doubleClick ( 250 , 200 ) . then ( function ( ) {
229
212
expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
230
213
done ( ) ;
231
214
} ) ;
@@ -283,7 +266,7 @@ describe('select box and lasso', function() {
283
266
y : 2.75
284
267
} ] , 'with the correct selected points' ) ;
285
268
286
- doubleClick ( 250 , 200 , function ( ) {
269
+ doubleClick ( 250 , 200 ) . then ( function ( ) {
287
270
expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
288
271
done ( ) ;
289
272
} ) ;
0 commit comments