test for data-rel back and dialog fix

This commit is contained in:
John Bender 2011-03-04 23:34:54 -08:00
parent 291bb306dd
commit 5fd1e70218
2 changed files with 30 additions and 1 deletions

View file

@ -112,5 +112,21 @@
<h1>Dialog</h1>
</div>
</div>
<div id="skip-dialog-first" data-role="page">
<div data-role="content">
<a href="#skip-dialog" data-role="button" data-transition="pop" data-rel="dialog">Dialog</a>
</div>
</div>
<div id="skip-dialog" data-role="dialog">
<div data-role="content">
<a href="#skip-dialog-second">Page 2</a>
</div>
</div>
<div id="skip-dialog-second" data-role="page">
<a href="#" data-rel="back">Go Back</a>
</div>
</body>
</html>

View file

@ -56,7 +56,7 @@
});
test( "path.get method is working properly", function(){
window.location.hash = "foo"
window.location.hash = "foo";
same($.mobile.path.get(), "foo", "get method returns location.hash minus hash character");
same($.mobile.path.get( "#foo/bar/baz.html" ), "foo/bar/", "get method with hash arg returns path with no filename or hash prefix");
same($.mobile.path.get( "#foo/bar/baz.html/" ), "foo/bar/baz.html/", "last segment of hash is retained if followed by a trailing slash");
@ -244,5 +244,18 @@
start();
}], 1000);
});
asyncTest( "going back from a page entered from a dialog skips the dialog and goes to the last page", function(){
$.testHelper.openPage("#skip-dialog-first");
$.testHelper.sequence([
function(){ $("#skip-dialog-first a").click(); },
function(){ $("#skip-dialog a").click(); },
function(){ $("#skip-dialog-second a").click(); },
function(){
same(location.hash, "#skip-dialog-first", "should be the first page in the sequence");
start();
}], 1000);
});
})(jQuery);