@@ -2,7 +2,7 @@ var d3 = require('d3');
22
33var Plotly = require ( '@lib/index' ) ;
44var Lib = require ( '@src/lib' ) ;
5- var DBLCLICKDELAY = require ( '@src/plots/cartesian/constants' ) . DBLCLICKDELAY ;
5+ var doubleClick = require ( '../assets/double_click' ) ;
66
77var createGraphDiv = require ( '../assets/create_graph_div' ) ;
88var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -35,23 +35,6 @@ describe('select box and lasso', function() {
3535 mouseEvent ( 'mouseup' , path [ len - 1 ] [ 0 ] , path [ len - 1 ] [ 1 ] ) ;
3636 }
3737
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-
5538 function assertRange ( actual , expected ) {
5639 var PRECISION = 4 ;
5740
@@ -104,7 +87,7 @@ describe('select box and lasso', function() {
10487
10588 drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
10689
107- doubleClick ( x2 , y2 , done ) ;
90+ doubleClick ( x2 , y2 ) . then ( done ) ;
10891 } ) ;
10992 } ) ;
11093
@@ -153,7 +136,7 @@ describe('select box and lasso', function() {
153136
154137 drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
155138
156- doubleClick ( x2 , y2 , done ) ;
139+ doubleClick ( x2 , y2 ) . then ( done ) ;
157140 } ) ;
158141 } ) ;
159142
@@ -225,7 +208,7 @@ describe('select box and lasso', function() {
225208 y : [ 0.10209191961595454 , 24.512223978291406 ]
226209 } , 'with the correct selected range' ) ;
227210
228- doubleClick ( 250 , 200 , function ( ) {
211+ doubleClick ( 250 , 200 ) . then ( function ( ) {
229212 expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
230213 done ( ) ;
231214 } ) ;
@@ -283,7 +266,7 @@ describe('select box and lasso', function() {
283266 y : 2.75
284267 } ] , 'with the correct selected points' ) ;
285268
286- doubleClick ( 250 , 200 , function ( ) {
269+ doubleClick ( 250 , 200 ) . then ( function ( ) {
287270 expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
288271 done ( ) ;
289272 } ) ;
0 commit comments