@@ -39,6 +39,15 @@ describe('select box and lasso', function() {
3939 } , DBLCLICKDELAY / 2 ) ;
4040 }
4141
42+ function assertRange ( actual , expected ) {
43+ var PRECISION = 4 ;
44+
45+ expect ( actual . x [ 0 ] ) . toBeCloseTo ( expected . x [ 0 ] , PRECISION ) ;
46+ expect ( actual . x [ 1 ] ) . toBeCloseTo ( expected . x [ 1 ] , PRECISION ) ;
47+ expect ( actual . y [ 0 ] ) . toBeCloseTo ( expected . y [ 0 ] , PRECISION ) ;
48+ expect ( actual . y [ 1 ] ) . toBeCloseTo ( expected . y [ 1 ] , PRECISION ) ;
49+ }
50+
4251 describe ( 'select events' , function ( ) {
4352 var mockCopy = Lib . extendDeep ( { } , mock ) ;
4453 mockCopy . layout . dragmode = 'select' ;
@@ -85,7 +94,7 @@ describe('select box and lasso', function() {
8594 x : 0.004 ,
8695 y : 12.5
8796 } ] ) ;
88- expect ( selectingData . range ) . toEqual ( {
97+ assertRange ( selectingData . range , {
8998 x : [ 0.0019667582669138295 , 0.004546754982054625 ] ,
9099 y : [ 0.10209191961595454 , 24.512223978291406 ]
91100 } ) ;
@@ -102,7 +111,7 @@ describe('select box and lasso', function() {
102111 x : 0.004 ,
103112 y : 12.5
104113 } ] ) ;
105- expect ( selectedData . range ) . toEqual ( {
114+ assertRange ( selectedData . range , {
106115 x : [ 0.0019667582669138295 , 0.004546754982054625 ] ,
107116 y : [ 0.10209191961595454 , 24.512223978291406 ]
108117 } ) ;
0 commit comments