Skip to content

Commit

Permalink
Position: Test for window scrollTop support and run scrolled window test
Browse files Browse the repository at this point in the history
only when support is there. Should exclude mobile devices, getting the
position testsuite to produce more useful results.
  • Loading branch information
jzaefferer committed Feb 26, 2011
1 parent e72afe4 commit 3d3b5dd
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tests/unit/position/position_core.js
Expand Up @@ -139,6 +139,8 @@ test('of', function() {
left: $(document).width() - 10
}, 'document');

$(window).scrollTop(0);

$('#elx').position({
my: 'right bottom',
at: 'right bottom',
Expand All @@ -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({
Expand Down

0 comments on commit 3d3b5dd

Please sign in to comment.