From 5811440641332a4fc2ad3b115ee670c9f7cc21e0 Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Fri, 30 Sep 2011 12:40:57 -0700 Subject: [PATCH] Added a test for diretly loading Urls with a hash that contains just the dialogHashKey. This tests to make sure these issues don't happen again: Issue #2570 - Refreshing a page with #&ui-state=dialog causes syntax error Issue #2582 - Refreshing a page with #&ui-state=dialog causes page duplication --- tests/unit/navigation/index.html | 2 +- tests/unit/navigation/navigation_core.js | 29 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/unit/navigation/index.html b/tests/unit/navigation/index.html index 11fb0569..00be956f 100644 --- a/tests/unit/navigation/index.html +++ b/tests/unit/navigation/index.html @@ -32,7 +32,7 @@
-
+
diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index 2c2d3a7e..b22811bc 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -929,4 +929,33 @@ } ]); }); + + + asyncTest( "application url with dialogHashKey loads application's first page", function(){ + $.testHelper.pageSequence([ + // open our test page + function(){ + // Navigate to any page except the first page of the application. + $.testHelper.openPage("#foo"); + }, + + function(){ + ok( $.mobile.activePage[ 0 ] === $( "#foo" )[ 0 ], "navigated successfully to #foo" ); + + // Now navigate to an hash that contains just a dialogHashKey. + $.mobile.changePage("#" + $.mobile.dialogHashKey); + }, + + function(){ + // Make sure we actually navigated to the first page. + ok( $.mobile.activePage[ 0 ] === $.mobile.firstPage[ 0 ], "navigated successfully to first-page" ); + + // Now make sure opening the page didn't result in page duplication. + ok( $.mobile.firstPage.hasClass( "first-page" ), "first page has expected class" ); + same( $( ".first-page" ).length, 1, "first page was not duplicated" ); + + start(); + } + ]); + }); })(jQuery);