diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-03-22 12:25:25 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-03-22 12:25:25 -0400 |
commit | 6f051d5d6a8eaf6fcc2a08ff68dbf5378029abc2 (patch) | |
tree | de1f0fd9b2cc00769c4117f58198a6c2784262d2 /tests/unit/position | |
parent | d4dadd14c293dfcbb4a7a214430ec511fea7a1da (diff) | |
download | jquery-ui-6f051d5d6a8eaf6fcc2a08ff68dbf5378029abc2.tar.gz jquery-ui-6f051d5d6a8eaf6fcc2a08ff68dbf5378029abc2.zip |
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.
Diffstat (limited to 'tests/unit/position')
-rw-r--r-- | tests/unit/position/position_core.js | 36 |
1 files changed, 35 insertions, 1 deletions
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', |