|
14 | 14 |
|
15 | 15 | teardown: function(){
|
16 | 16 | $("#scroll-testing").remove();
|
| 17 | + window.fizz = ''; |
17 | 18 | }
|
18 | 19 | });
|
19 | 20 |
|
20 | 21 | var scrollUp = function( pos ){
|
21 | 22 | $(window).scrollTop(1000);
|
22 |
| - ok($(window).scrollTop() > 0); |
23 |
| - |
24 |
| - if(pos) { |
25 |
| - $.mobile.silentScroll(pos); |
26 |
| - } else { |
27 |
| - $.mobile.silentScroll(); |
28 |
| - } |
| 23 | + ok($(window).scrollTop() > 0, $(window).scrollTop()); |
| 24 | + $.mobile.silentScroll(pos); |
29 | 25 | };
|
30 | 26 |
|
31 |
| - test( "silent scroll scrolls the page to the top by default", function(){ |
| 27 | + asyncTest( "silent scroll scrolls the page to the top by default", function(){ |
32 | 28 | scrollUp();
|
33 | 29 |
|
34 |
| - stop(); |
35 | 30 | setTimeout(function(){
|
36 | 31 | same($(window).scrollTop(), 0);
|
37 | 32 | start();
|
38 | 33 | }, scrollTimeout);
|
39 | 34 | });
|
40 | 35 |
|
41 |
| - test( "silent scroll scrolls the page to the passed y position", function(){ |
| 36 | + asyncTest( "silent scroll scrolls the page to the passed y position", function(){ |
42 | 37 | var pos = 10;
|
43 | 38 | scrollUp(pos);
|
44 | 39 |
|
45 |
| - stop(); |
46 | 40 | setTimeout(function(){
|
47 | 41 | same($(window).scrollTop(), pos);
|
48 | 42 | start();
|
49 | 43 | }, scrollTimeout);
|
50 | 44 | });
|
51 | 45 |
|
52 | 46 | // NOTE may be brittle depending on timing
|
53 |
| - test( "silent scroll takes at least 20 ms to scroll to the top", function(){ |
| 47 | + asyncTest( "silent scroll takes at least 20 ms to scroll to the top", function(){ |
54 | 48 | scrollUp();
|
55 | 49 |
|
56 |
| - stop(); |
57 | 50 | setTimeout(function(){
|
58 |
| - ok($(window).scrollTop() != 0); |
| 51 | + ok($(window).scrollTop() != 0, "scrolltop position should not be zero"); |
59 | 52 | start();
|
60 |
| - }, scrollTimeout - 1); |
| 53 | + }, scrollTimeout - 2); |
61 | 54 | });
|
62 | 55 |
|
63 |
| - test( "scrolling marks scrollstart as disabled for 150 ms", function(){ |
| 56 | + asyncTest( "scrolling marks scrollstart as disabled for 150 ms", function(){ |
64 | 57 | $.event.special.scrollstart.enabled = true;
|
65 | 58 | scrollUp();
|
66 | 59 | ok(!$.event.special.scrollstart.enabled);
|
67 | 60 |
|
68 |
| - stop(); |
69 | 61 | setTimeout(function(){
|
70 | 62 | ok($.event.special.scrollstart.enabled);
|
71 | 63 | start();
|
|
0 commit comments