diff options
author | Thomas Meyer <meyertee@gmail.com> | 2013-09-04 23:20:45 +0200 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-02-09 11:57:15 -0500 |
commit | 9db405798dd5fc8ee603991226916351ec2a0dda (patch) | |
tree | bb4b81f95ea4ff96983c2c1d37746f4adbb0d80d /tests/unit | |
parent | 276cd5cd8cbef787328335a11ad19864242ccafd (diff) | |
download | jquery-ui-9db405798dd5fc8ee603991226916351ec2a0dda.tar.gz jquery-ui-9db405798dd5fc8ee603991226916351ec2a0dda.zip |
Position: Add unit tests for bug 8710
Ref #8710
Closes gh-1071
(cherry picked from commit 4de983c6d5eacbdc668c0b7280d9818dd6281a53)
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/position/position.html | 3 | ||||
-rw-r--r-- | tests/unit/position/position_core.js | 37 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index 0cad7d322..334fbbb78 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -47,6 +47,9 @@ elements smaller than 20px have a line-height set on them to avoid a bug in IE6 <div id="bug-5280" style="height: 30px; width: 201px;"> <div style="width: 50px; height: 10px;"></div> </div> + + <div id="bug-8710-within-smaller" style="position: absolute; width: 100px; height: 99px; top: 0px; left: 0px; line-height: 99px;"></div> + <div id="bug-8710-within-bigger" style="position: absolute; width: 100px; height: 101px; top: 0px; left: 0px; line-height: 101px;"></div> </div> </body> diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 5b1872af9..7176e37e1 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -726,4 +726,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 + }, "no flip - top fits less" ); +}); + }( jQuery ) ); |