diff --git a/demos/tooltip/custom-style.html b/demos/tooltip/custom-style.html index 4d48616cb..633da3d95 100644 --- a/demos/tooltip/custom-style.html +++ b/demos/tooltip/custom-style.html @@ -13,76 +13,67 @@ diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index 518e1f960..2a6e43d36 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -43,7 +43,7 @@ elements smaller than 10px have a line-height set on them to avoid a bug in IE6
-
+
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 837327b5d..e68e310f1 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -255,11 +255,30 @@ test( "offsets", function() { }); test( "using", function() { - expect( 6 ); + expect( 10 ); var count = 0, elems = $( "#el1, #el2" ), - expectedPosition = { top: 40, left: 40 }, + of = $( "#parentx" ), + expectedPosition = { top: 60, left: 60 }, + expectedFeedback = { + target: { + element: of, + width: 20, + height: 20, + left: 40, + top: 40 + }, + element: { + width: 6, + height: 6, + left: 60, + top: 60 + }, + horizontal: "left", + vertical: "top", + important: "vertical" + }, originalPosition = elems.position({ my: "right bottom", at: "rigt bottom", @@ -269,11 +288,14 @@ test( "using", function() { elems.position({ my: "left top", - at: "left top", + at: "center+10 bottom", of: "#parentx", - using: function( position ) { + using: function( position, feedback ) { deepEqual( this, elems[ count ], "correct context for call #" + count ); deepEqual( position, expectedPosition, "correct position for call #" + count ); + deepEqual( feedback.element.element[ 0 ], elems[ count ] ); + delete feedback.element.element; + deepEqual( feedback, expectedFeedback ); count++; } }); @@ -569,6 +591,67 @@ test( "within", function() { }, "flipfit - left top" ); }); +test( "with scrollbars", function() { + expect( 4 ); + + $( "#scrollx" ).css({ + width: 100, + height: 100, + left: 0, + top: 0 + }); + + collisionTest({ + of: "#scrollx", + collision: "fit", + within: "#scrollx" + }, { + top: 90, + left: 90 + }, "visible" ); + + $( "#scrollx" ).css({ + overflow: "scroll" + }); + + var scrollbarInfo = $.position.getScrollInfo( $.position.getWithinInfo( $( "#scrollx" ) ) ); + + collisionTest({ + of: "#scrollx", + collision: "fit", + within: "#scrollx" + }, { + top: 90 - scrollbarInfo.height, + left: 90 - scrollbarInfo.width + }, "scroll" ); + + $( "#scrollx" ).css({ + overflow: "auto" + }); + + collisionTest({ + of: "#scrollx", + collision: "fit", + within: "#scrollx" + }, { + top: 90, + left: 90 + }, "auto, no scroll" ); + + $( "#scrollx" ).css({ + overflow: "auto" + }).append( $("
").height(300).width(300) ); + + collisionTest({ + of: "#scrollx", + collision: "fit", + within: "#scrollx" + }, { + top: 90 - scrollbarInfo.height, + left: 90 - scrollbarInfo.width + }, "auto, with scroll" ); +}); + test( "fractions", function() { expect( 1 ); diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html index b9b769d9b..64c5d2300 100644 --- a/tests/visual/position/position.html +++ b/tests/visual/position/position.html @@ -10,23 +10,31 @@ - + + + + + + + + + +
all around me
+
+ + + diff --git a/tests/visual/position/position_feedback_rotate.html b/tests/visual/position/position_feedback_rotate.html new file mode 100644 index 000000000..11138b112 --- /dev/null +++ b/tests/visual/position/position_feedback_rotate.html @@ -0,0 +1,109 @@ + + + + + Position Visual Test: Default + + + + + + + + + + + + +
all around me
+
+ + + diff --git a/tests/visual/position/position_fit.html b/tests/visual/position/position_fit.html index 9c60b78f6..dbd52550f 100644 --- a/tests/visual/position/position_fit.html +++ b/tests/visual/position/position_fit.html @@ -10,7 +10,6 @@ - - - -