From 6f051d5d6a8eaf6fcc2a08ff68dbf5378029abc2 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 22 Mar 2011 12:25:25 -0400 Subject: Position: Merged offset option into my and at options and added support for percentage-based offsets. Fixes #6981 - Position: Merge offset option into my and at options. Fixes #7028 - Position: Allow percent-based offsets. --- tests/unit/position/position_core.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'tests/unit/position') diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 643561c20..66f7a8504 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -207,7 +207,41 @@ test('of', function() { }, 'event - left top, right bottom'); }); -test('offset', function() { +test('offsets', function() { + $('#elx').position({ + my: 'left top', + at: 'left+10 bottom+10', + of: '#parentx', + collision: 'none' + }); + same($('#elx').offset(), { top: 70, left: 50 }, 'offsets in at'); + + $('#elx').position({ + my: 'left+10 top-10', + at: 'left bottom', + of: '#parentx', + collision: 'none' + }); + same($('#elx').offset(), { top: 50, left: 50 }, 'offsets in my'); + + $('#elx').position({ + my: 'left top', + at: 'left+50% bottom-10%', + of: '#parentx', + collision: 'none' + }); + same($('#elx').offset(), { top: 58, left: 50 }, 'percentage offsets in at'); + + $('#elx').position({ + my: 'left-30% top+50%', + at: 'left bottom', + of: '#parentx', + collision: 'none' + }); + same($('#elx').offset(), { top: 65, left: 37 }, 'percentage offsets in my'); +}); + +test('offset - deprecated', function() { $('#elx').position({ my: 'left top', at: 'left bottom', -- cgit v1.2.3