r2888 - positonTo: fixed that one remaining test (offset reversed) and refactored others
Author: joern.zaefferer
Date: Tue Jul 7 14:28:57 2009
New Revision: 2888
Modified:
branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
Log:
positonTo: fixed that one remaining test (offset reversed) and refactored
others
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:28:57 2009
@@ -242,14 +242,19 @@
same(elem.offset(), result, msg);
}
+function collisionTest2(config, result, msg) {
+ collisionTest($.extend({
+ my: "right bottom",
+ at: "left top",
+ }, config), result, msg);
+}
+
test("collision: fit, no offset", function() {
collisionTest({
collision: "fit"
}, { top: $(window).height() - 10, left: $(window).width() - 10 }, "right
bottom");
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "fit"
}, { top: 0, left: 0 }, "left top");
});
@@ -260,16 +265,12 @@
offset: "2 3"
}, { top: $(window).height() - 10, left: $(window).width() - 10 }, "right
bottom")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "fit",
offset: "2 3"
}, { top: 0, left: 0 }, "left top, positive offset")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "fit",
offset: "-2 -3"
}, { top: 0, left: 0 }, "left top, negative offset")
@@ -280,9 +281,7 @@
collision: "flip"
}, { top: -10, left: -10 }, "left top")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "flip"
}, { top: $(window).height(), left: $(window).width() }, "right bottom");
});
@@ -293,16 +292,12 @@
offset: "2 3"
}, { top: -13, left: -12 }, "left top, with offset added")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "flip",
offset: "2 3"
}, { top: $(window).height() - 3, left: $(window).width() - 2 }, "bottom,
positive offset")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "flip",
offset: "-2 -3"
}, { top: $(window).height() + 3, left: $(window).width() + 2 }, "right
bottom, negative offset")
@@ -313,9 +308,7 @@
collision: "none"
}, { top: $(window).height(), left: $(window).width() }, "left top")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "none"
}, { top: -10, left: -10 }, "moved to the right bottom");
});
@@ -324,18 +317,14 @@
collisionTest({
collision: "none",
offset: "2 3"
- }, { top: $(window).height() + 2, left: $(window).width() + 3 }, "right
bottom, with offset added")
+ }, { top: $(window).height() + 3, left: $(window).width() + 2 }, "right
bottom, with offset added")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "none",
offset: "2 3"
}, { top: -7, left: -8 }, "left top, positive offset")
- collisionTest({
- my: "right bottom",
- at: "left top",
+ collisionTest2({
collision: "none",
offset: "-2 -3"
}, { top: -13, left: -12 }, "left top, negative offset")