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
This commit is contained in:
Kin Blas 2011-09-30 12:40:57 -07:00
parent 98eda9a0f4
commit 5811440641
2 changed files with 30 additions and 1 deletions

View file

@ -32,7 +32,7 @@
<ol id="qunit-tests">
</ol>
<div id="harmless-default-page" data-nstest-role="page">
<div id="harmless-default-page" data-nstest-role="page" class="first-page">
</div>
<div id="foo" data-nstest-role="page" class="foo-class">

View file

@ -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);