aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-02-26 11:23:37 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-02-26 11:25:41 +0100
commit3d3b5dd1e7f677e351a48940461fd135f19fed13 (patch)
treed1531e9bc6880eeeb605647a3eb96f67e8fdabea
parente72afe4afca0795fc785114cfeafbe08f5e2fdf3 (diff)
downloadjquery-ui-3d3b5dd1e7f677e351a48940461fd135f19fed13.tar.gz
jquery-ui-3d3b5dd1e7f677e351a48940461fd135f19fed13.zip
Position: Test for window scrollTop support and run scrolled window test
only when support is there. Should exclude mobile devices, getting the position testsuite to produce more useful results.
-rw-r--r--tests/unit/position/position_core.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index f4075ccfe..643561c20 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -139,6 +139,8 @@ test('of', function() {
left: $(document).width() - 10
}, 'document');
+ $(window).scrollTop(0);
+
$('#elx').position({
my: 'right bottom',
at: 'right bottom',
@@ -161,18 +163,24 @@ test('of', function() {
left: $(window).width() - 10
}, 'window');
- $(window).scrollTop(500).scrollLeft(200);
- $('#elx').position({
- my: 'right bottom',
- at: 'right bottom',
- of: window,
- collision: 'none'
- });
- same($('#elx').offset(), {
- top: $(window).height() + 500 - 10,
- left: $(window).width() + 200 - 10
- }, 'window, scrolled');
- $(window).scrollTop(0).scrollLeft(0);
+ var scrollTopSupport = (function() {
+ $(window).scrollTop(1);
+ return $(window).scrollTop() == 1;
+ })();
+ if (scrollTopSupport) {
+ $(window).scrollTop(500).scrollLeft(200);
+ $('#elx').position({
+ my: 'right bottom',
+ at: 'right bottom',
+ of: window,
+ collision: 'none'
+ });
+ same($('#elx').offset(), {
+ top: $(window).height() + 500 - 10,
+ left: $(window).width() + 200 - 10
+ }, 'window, scrolled');
+ $(window).scrollTop(0).scrollLeft(0);
+ }
var event = $.extend($.Event('someEvent'), { pageX: 200, pageY: 300 });
$('#elx').position({