@@ -39,6 +39,15 @@ describe('select box and lasso', function() {
39
39
} , DBLCLICKDELAY / 2 ) ;
40
40
}
41
41
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
+
42
51
describe ( 'select events' , function ( ) {
43
52
var mockCopy = Lib . extendDeep ( { } , mock ) ;
44
53
mockCopy . layout . dragmode = 'select' ;
@@ -85,7 +94,7 @@ describe('select box and lasso', function() {
85
94
x : 0.004 ,
86
95
y : 12.5
87
96
} ] ) ;
88
- expect ( selectingData . range ) . toEqual ( {
97
+ assertRange ( selectingData . range , {
89
98
x : [ 0.0019667582669138295 , 0.004546754982054625 ] ,
90
99
y : [ 0.10209191961595454 , 24.512223978291406 ]
91
100
} ) ;
@@ -102,7 +111,7 @@ describe('select box and lasso', function() {
102
111
x : 0.004 ,
103
112
y : 12.5
104
113
} ] ) ;
105
- expect ( selectedData . range ) . toEqual ( {
114
+ assertRange ( selectedData . range , {
106
115
x : [ 0.0019667582669138295 , 0.004546754982054625 ] ,
107
116
y : [ 0.10209191961595454 , 24.512223978291406 ]
108
117
} ) ;
0 commit comments