@@ -3,6 +3,8 @@ var d3 = require('d3');
33var Plotly = require ( '@lib/index' ) ;
44var Lib = require ( '@src/lib' ) ;
55var DBLCLICKDELAY = require ( '@src/plots/cartesian/constants' ) . DBLCLICKDELAY ;
6+ var click = require ( '../assets/click' ) ;
7+ var doubleClick = require ( '../assets/double_click' ) ;
68
79var createGraphDiv = require ( '../assets/create_graph_div' ) ;
810var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -35,23 +37,6 @@ describe('select box and lasso', function() {
3537 mouseEvent ( 'mouseup' , path [ len - 1 ] [ 0 ] , path [ len - 1 ] [ 1 ] ) ;
3638 }
3739
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-
5540 function assertRange ( actual , expected ) {
5641 var PRECISION = 4 ;
5742
@@ -104,7 +89,7 @@ describe('select box and lasso', function() {
10489
10590 drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
10691
107- doubleClick ( x2 , y2 , done ) ;
92+ doubleClick ( x2 , y2 ) . then ( done ) ;
10893 } ) ;
10994 } ) ;
11095
@@ -153,7 +138,7 @@ describe('select box and lasso', function() {
153138
154139 drag ( [ [ x0 , y0 ] , [ x1 , y1 ] ] ) ;
155140
156- doubleClick ( x2 , y2 , done ) ;
141+ doubleClick ( x2 , y2 ) . then ( done ) ;
157142 } ) ;
158143 } ) ;
159144
@@ -225,7 +210,7 @@ describe('select box and lasso', function() {
225210 y : [ 0.10209191961595454 , 24.512223978291406 ]
226211 } , 'with the correct selected range' ) ;
227212
228- doubleClick ( 250 , 200 , function ( ) {
213+ doubleClick ( 250 , 200 ) . then ( function ( ) {
229214 expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
230215 done ( ) ;
231216 } ) ;
@@ -283,7 +268,7 @@ describe('select box and lasso', function() {
283268 y : 2.75
284269 } ] , 'with the correct selected points' ) ;
285270
286- doubleClick ( 250 , 200 , function ( ) {
271+ doubleClick ( 250 , 200 ) . then ( function ( ) {
287272 expect ( doubleClickData ) . toBe ( null , 'with the correct deselect data' ) ;
288273 done ( ) ;
289274 } ) ;
0 commit comments