Skip to content

Commit

Permalink
add test spec for #2437 subpixel offset calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelmy committed Jul 15, 2015
1 parent fa4145f commit ed2150d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Specs/Element/Element.Dimensions.js 100644 → 100755
Expand Up @@ -193,6 +193,33 @@ describe('Element.Dimensions', function(){
expect(relDiv.getPosition(div)).toEqual({x: 8, y: 8});
});

it('should match subpixels if needed', function(){
var oddSizedDiv = new Element('div', {
styles: {
width: 51,
height: 51,
margin: 5,
border: '1px solid green',
visibility: 'hidden',
position: 'relative',
overflow: 'hidden',
'float': 'left'
}
}).inject($(document.body));

var insideOddSizedDiv = new Element('div', {
styles: {
width: 10,
height: 10,
margin: '5.5px auto',
visibility: 'hidden',
overflow: 'hidden'
}
}).inject(oddSizedDiv);

expect(insideOddSizedDiv.getPosition(oddSizedDiv)).toEqual({x: 20.5, y: 5.5});
});

});

describe('Element.getCoordinates', function(){
Expand Down

0 comments on commit ed2150d

Please sign in to comment.