From 9df981d268b4029065247cf230a4e988946b7799 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Apr 2012 16:07:58 -0400 Subject: [PATCH] Position: Added tests for flipfit. --- tests/unit/position/position_core.js | 60 ++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 7a9a35132..0ebcabef3 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -387,6 +387,44 @@ test( "collision: flip, collision", function() { }, "with offset" ); }); +test( "collision: flipfit, no collision", function() { + expect( 2 ); + + collisionTest({ + collision: "flipfit" + }, { + top: 10, + left: 10 + }, "no offset" ); + + collisionTest({ + collision: "flipfit", + at: "right+2 bottom+3" + }, { + top: 13, + left: 12 + }, "with offset" ); +}); + +test( "collision: flipfit, collision", function() { + expect( 2 ); + + collisionTest2({ + collision: "flipfit" + }, { + top: 10, + left: 10 + }, "no offset" ); + + collisionTest2({ + collision: "flipfit", + at: "left+2 top+3" + }, { + top: 7, + left: 8 + }, "with offset" ); +}); + test( "collision: none, no collision", function() { expect( 2 ); @@ -480,7 +518,7 @@ test( "collision: flip, with margin", function() { }); test( "within", function() { - expect( 4 ); + expect( 6 ); collisionTest({ within: "#within", @@ -504,7 +542,7 @@ test( "within", function() { }, { top: 10, left: -6 - }, "fit - right bottom" ); + }, "flip - right bottom" ); collisionTest2({ within: "#within", @@ -512,7 +550,23 @@ test( "within", function() { }, { top: 10, left: -6 - }, "fit - left top" ); + }, "flip - left top" ); + + collisionTest({ + within: "#within", + collision: "flipfit" + }, { + top: 4, + left: 0 + }, "flipfit - right bottom" ); + + collisionTest2({ + within: "#within", + collision: "flipfit" + }, { + top: 4, + left: 0 + }, "flipfit - left top" ); }); test( "fractions", function() { -- 2.39.5