File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,33 @@ describe('Element.Dimensions', function(){
193193 expect ( relDiv . getPosition ( div ) ) . toEqual ( { x : 8 , y : 8 } ) ;
194194 } ) ;
195195
196+ it ( 'should match subpixels if needed' , function ( ) {
197+ var oddSizedDiv = new Element ( 'div' , {
198+ styles : {
199+ width : 51 ,
200+ height : 51 ,
201+ margin : 5 ,
202+ visibility : 'hidden' ,
203+ position : 'relative' ,
204+ overflow : 'hidden' ,
205+ 'float' : 'left'
206+ }
207+ } ) . inject ( $ ( document . body ) ) ;
208+
209+ var insideOddSizedDiv = new Element ( 'div' , {
210+ styles : {
211+ width : 10 ,
212+ height : 10 ,
213+ margin : 5.5 ,
214+ visibility : 'hidden' ,
215+ overflow : 'hidden'
216+ }
217+ } ) . inject ( oddSizedDiv ) ;
218+
219+ expect ( insideOddSizedDiv . getPosition ( oddSizedDiv ) . x )
220+ . toEqual ( insideOddSizedDiv . getBoundingClientRect ( ) . left - oddSizedDiv . getBoundingClientRect ( ) . left ) ;
221+ } ) ;
222+
196223 } ) ;
197224
198225 describe ( 'Element.getCoordinates' , function ( ) {
You can’t perform that action at this time.
0 commit comments