diff options
author | Ben Hollis <ben@benhollis.net> | 2010-09-03 10:38:44 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-09-03 10:38:44 -0400 |
commit | 4b9d5d1b5bd36726c6e49b105c0f75649cca1ae4 (patch) | |
tree | a03bc490cc46c0c1bacddd9d2afd140dcdaf4a8f /tests | |
parent | 0a0a39f896f83412dc91bedd6819c3a3a0932302 (diff) | |
download | jquery-ui-4b9d5d1b5bd36726c6e49b105c0f75649cca1ae4.tar.gz jquery-ui-4b9d5d1b5bd36726c6e49b105c0f75649cca1ae4.zip |
Position: Take margin into account when performing collisions. Fixes #5766 - position: collision should take margin into account.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/position/position_core.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 426231ee3..f4075ccfe 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -354,6 +354,58 @@ test("collision: none, with offset", function() { }, { top: -13, left: -12 }, "left top, negative offset"); }); +test("collision: fit, with margin", function() { + $("#elx").css("margin", 10); + + collisionTest({ + collision: "fit" + }, { top: $(window).height() - 20, left: $(window).width() - 20 }, "right bottom"); + + collisionTest2({ + collision: "fit" + }, { top: 10, left: 10 }, "left top"); + + $("#elx").css({ + "margin-left": 5, + "margin-top": 5 + }); + + collisionTest({ + collision: "fit" + }, { top: $(window).height() - 20, left: $(window).width() - 20 }, "right bottom"); + + collisionTest2({ + collision: "fit" + }, { top: 5, left: 5 }, "left top"); + + $("#elx").css({ + "margin-right": 15, + "margin-bottom": 15 + }); + + collisionTest({ + collision: "fit" + }, { top: $(window).height() - 25, left: $(window).width() - 25 }, "right bottom"); + + collisionTest2({ + collision: "fit" + }, { top: 5, left: 5 }, "left top"); +}); + +test("collision: flip, with margin", function() { + $("#elx").css("margin", 10); + + collisionTest({ + collision: "flip", + at: "left top" + }, { top: $(window).height() - 10, left: $(window).width() - 10 }, "left top"); + + collisionTest2({ + collision: "flip", + at: "right bottom" + }, { top: 0, left: 0 }, "right bottom"); +}); + //test('bug #5280: consistent results (avoid fractional values)', function() { // var wrapper = $('#bug-5280'), // elem = wrapper.children(), |