From 28bb987729bfddff80ffa48e82f991c9ef2aa158 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Wed, 7 Sep 2011 09:16:02 -0400 Subject: [PATCH] added a unit test for last-scroll remembering. --- tests/unit/navigation/navigation_core.js | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index 93dffe70..da6fc784 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -110,6 +110,38 @@ start(); }]); }); + + asyncTest( "page last scroll distance is remembered while navigating to and from pages", function(){ + $.testHelper.pageSequence([ + navigateTestRoot, + + function(){ + $( "body" ).height( $( window ).height() + 500 ); + }, + + function(){ + $.mobile.changePage( "external.html" ); + }, + + function(){ + window.scrollTo( 0, 300 ); + }, + + navigateTestRoot, + + function(){ + $.mobile.changePage( "external.html" ); + }, + + function(){ + same( $(window).scrollTop(), 300 ); + $( "body" ).height( "" ); + start(); + } + + ]); + + }); asyncTest( "forms with data attribute ajax set to false will not call changePage", function(){ var called = false;