2 * mobile core unit tests
6 var libName = "jquery.mobile.core.js",
7 scrollTimeout = 20, // TODO expose timing as an attribute
8 scrollStartEnabledTimeout = 150;
12 $("<div id='scroll-testing' style='height: 1000px'></div>").appendTo("body");
16 $("#scroll-testing").remove();
20 var scrollUp = function( pos ){
21 $(window).scrollTop(1000);
22 ok($(window).scrollTop() > 0, $(window).scrollTop());
23 $.mobile.silentScroll(pos);
26 asyncTest( "silent scroll scrolls the page to the top by default", function(){
29 setTimeout(function(){
30 same($(window).scrollTop(), 0);
35 asyncTest( "silent scroll scrolls the page to the passed y position", function(){
39 setTimeout(function(){
40 same($(window).scrollTop(), pos);
45 test( "silent scroll is async", function(){
47 ok($(window).scrollTop() != 0, "scrolltop position should not be zero");
51 asyncTest( "scrolling marks scrollstart as disabled for 150 ms", function(){
52 $.event.special.scrollstart.enabled = true;
54 ok(!$.event.special.scrollstart.enabled);
56 setTimeout(function(){
57 ok($.event.special.scrollstart.enabled);
59 }, scrollStartEnabledTimeout);
62 //TODO test that silentScroll is called on window load