r2887 - positionTo: added tests for collision:none, one actually fails with an odd 1px offset
Author: joern.zaefferer
Date: Tue Jul 7 14:20:41 2009
New Revision: 2887
Modified:
branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
Log:
positionTo: added tests for collision:none, one actually fails with an odd
1px offset
Modified: branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
==============================================================================
--- branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
(original)
+++ branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js Tue
Jul 7 14:20:41 2009
@@ -245,67 +245,100 @@
test("collision: fit, no offset", function() {
collisionTest({
collision: "fit"
- }, { top: $(window).height() - 10, left: $(window).width() - 10 }, "moved
to the right bottom");
+ }, { top: $(window).height() - 10, left: $(window).width() - 10 }, "right
bottom");
collisionTest({
my: "right bottom",
at: "left top",
collision: "fit"
- }, { top: 0, left: 0 }, "moved to the left top");
+ }, { top: 0, left: 0 }, "left top");
});
test("collision: fit, with offset", function() {
collisionTest({
collision: "fit",
offset: "2 3"
- }, { top: $(window).height() - 10, left: $(window).width() - 10 }, "moved
to the right bottom")
+ }, { top: $(window).height() - 10, left: $(window).width() - 10 }, "right
bottom")
collisionTest({
my: "right bottom",
at: "left top",
collision: "fit",
offset: "2 3"
- }, { top: 0, left: 0 }, "moved to the left top, positive offset")
+ }, { top: 0, left: 0 }, "left top, positive offset")
collisionTest({
my: "right bottom",
at: "left top",
collision: "fit",
offset: "-2 -3"
- }, { top: 0, left: 0 }, "moved to the left top, negative offset")
+ }, { top: 0, left: 0 }, "left top, negative offset")
});
test("collision: flip, no offset", function() {
collisionTest({
collision: "flip"
- }, { top: -10, left: -10 }, "moved to the left top")
+ }, { top: -10, left: -10 }, "left top")
collisionTest({
my: "right bottom",
at: "left top",
collision: "flip"
- }, { top: $(window).height(), left: $(window).width() }, "moved to the
right bottom");
+ }, { top: $(window).height(), left: $(window).width() }, "right bottom");
});
test("collision: flip, with offset", function() {
collisionTest({
collision: "flip",
offset: "2 3"
- }, { top: -13, left: -12 }, "moved to the left top, with offset added")
+ }, { top: -13, left: -12 }, "left top, with offset added")
collisionTest({
my: "right bottom",
at: "left top",
collision: "flip",
offset: "2 3"
- }, { top: $(window).height() - 3, left: $(window).width() - 2 }, "moved
to the right bottom, positive offset")
+ }, { top: $(window).height() - 3, left: $(window).width() - 2 }, "bottom,
positive offset")
collisionTest({
my: "right bottom",
at: "left top",
collision: "flip",
offset: "-2 -3"
- }, { top: $(window).height() + 3, left: $(window).width() + 2 }, "moved
to the right bottom, negative offset")
+ }, { top: $(window).height() + 3, left: $(window).width() + 2 }, "right
bottom, negative offset")
+});
+
+test("collision: none, no offset", function() {
+ collisionTest({
+ collision: "none"
+ }, { top: $(window).height(), left: $(window).width() }, "left top")
+
+ collisionTest({
+ my: "right bottom",
+ at: "left top",
+ collision: "none"
+ }, { top: -10, left: -10 }, "moved to the right bottom");
+});
+
+test("collision: none, with offset", function() {
+ collisionTest({
+ collision: "none",
+ offset: "2 3"
+ }, { top: $(window).height() + 2, left: $(window).width() + 3 }, "right
bottom, with offset added")
+
+ collisionTest({
+ my: "right bottom",
+ at: "left top",
+ collision: "none",
+ offset: "2 3"
+ }, { top: -7, left: -8 }, "left top, positive offset")
+
+ collisionTest({
+ my: "right bottom",
+ at: "left top",
+ collision: "none",
+ offset: "-2 -3"
+ }, { top: -13, left: -12 }, "left top, negative offset")
});
})(jQuery);