From d4a21eaf5b71222617017faed9f83c093c4657ff Mon Sep 17 00:00:00 2001
From: Thomas Meyer
Date: Wed, 4 Sep 2013 18:54:07 +0200
Subject: [PATCH 1/4] Revert "Position: Check to also make sure to only flip if
more of the element is inside "within""
This reverts commit 7f808b2047725cd8fde51a948cb4e5f5946c82e1.
Conflicts:
ui/jquery.ui.position.js
---
ui/jquery.ui.position.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index 21c3cef1b19..314ebe5bca4 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -431,13 +431,13 @@ $.ui.position = {
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
- if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+ if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
position.top += myOffset + atOffset + offset;
}
}
else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
- if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+ if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
position.top += myOffset + atOffset + offset;
}
}
From beab2acf1b09860cf4cbdc8a85e8750f3cc4cc4d Mon Sep 17 00:00:00 2001
From: Thomas Meyer
Date: Wed, 4 Sep 2013 23:20:45 +0200
Subject: [PATCH 2/4] added unit tests for bug 8710
---
tests/unit/position/position.html | 3 +++
tests/unit/position/position_core.js | 37 ++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html
index f3b1ad86ca8..21d4cc71b71 100644
--- a/tests/unit/position/position.html
+++ b/tests/unit/position/position.html
@@ -47,6 +47,9 @@
+
+
+
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index e03d4c11152..23df3698c4a 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -719,4 +719,41 @@ test( "bug #5280: consistent results (avoid fractional values)", function() {
deepEqual( offset1, offset2 );
});
+test( "bug #8710: flip if flipped position fits more", function() {
+ expect( 3 );
+
+ // positions a 10px tall element within 99px height at top 90px
+ collisionTest({
+ within: "#bug-8710-within-smaller",
+ of: "#parentx",
+ collision: "flip",
+ at: "right bottom+30"
+ }, {
+ top: 0,
+ left: 60
+ }, "flip - top fits all" );
+
+ // positions a 10px tall element within 99px height at top 92px
+ collisionTest({
+ within: "#bug-8710-within-smaller",
+ of: "#parentx",
+ collision: "flip",
+ at: "right bottom+32"
+ }, {
+ top: -2,
+ left: 60
+ }, "flip - top fits more" );
+
+ // positions a 10px tall element within 101px height at top 92px
+ collisionTest({
+ within: "#bug-8710-within-bigger",
+ of: "#parentx",
+ collision: "flip",
+ at: "right bottom+32"
+ }, {
+ top: 92,
+ left: 60
+ }, "flip - top fits less" );
+});
+
}( jQuery ) );
From 64ab7a2f6a4e59bfac0f8e4dfc37adea7cfbe8e7 Mon Sep 17 00:00:00 2001
From: Thomas Meyer
Date: Wed, 19 Nov 2014 17:49:56 +0100
Subject: [PATCH 3/4] Position: Convert comments to uppercase
---
tests/unit/position/position_core.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index 23df3698c4a..d8cac64695c 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -722,7 +722,7 @@ test( "bug #5280: consistent results (avoid fractional values)", function() {
test( "bug #8710: flip if flipped position fits more", function() {
expect( 3 );
- // positions a 10px tall element within 99px height at top 90px
+ // Positions a 10px tall element within 99px height at top 90px.
collisionTest({
within: "#bug-8710-within-smaller",
of: "#parentx",
@@ -733,7 +733,7 @@ test( "bug #8710: flip if flipped position fits more", function() {
left: 60
}, "flip - top fits all" );
- // positions a 10px tall element within 99px height at top 92px
+ // Positions a 10px tall element within 99px height at top 92px.
collisionTest({
within: "#bug-8710-within-smaller",
of: "#parentx",
@@ -744,7 +744,7 @@ test( "bug #8710: flip if flipped position fits more", function() {
left: 60
}, "flip - top fits more" );
- // positions a 10px tall element within 101px height at top 92px
+ // Positions a 10px tall element within 101px height at top 92px.
collisionTest({
within: "#bug-8710-within-bigger",
of: "#parentx",
From cd9066fd6831bc0908e1859a6aa6a33e626cf53b Mon Sep 17 00:00:00 2001
From: Thomas Meyer
Date: Wed, 19 Nov 2014 17:50:21 +0100
Subject: [PATCH 4/4] Position: Make test description more precise
---
tests/unit/position/position_core.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index d8cac64695c..d58699afcca 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -753,7 +753,7 @@ test( "bug #8710: flip if flipped position fits more", function() {
}, {
top: 92,
left: 60
- }, "flip - top fits less" );
+ }, "no flip - top fits less" );
});
}( jQuery ) );