Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4131 from gabrielschulhof/unit-test-for-dialog-do…

…uble-hash

[unit tests] Add unit test for dialog double hash fix -- Re: #2656
  • Loading branch information...
commit 047e1dd0e691accd5423fe265fb84572d8803f50 2 parents 49c87f9 + b3011fd
@gseguin gseguin authored
View
11 tests/unit/navigation/index.html
@@ -146,6 +146,17 @@ <h2 id="qunit-userAgent"></h2>
<a href="#" data-nstest-rel="back">Go Back</a>
</div>
+<div id="dialog-double-hash-test-dialog" data-nstest-role="dialog">
+ <div data-nstest-role="header">
+ <h1>Dialog</h1>
+ </div>
+</div>
+
+<div id="dialog-double-hash-test" data-nstest-role="page">
+ <div data-nstest-role="content">
+ <a href="#dialog-double-hash-test-dialog">Dialog</a>
+ </div>
+</div>
<div id="nested-dialog-page" data-nstest-role="page">
<div data-nstest-role="content">
View
31 tests/unit/navigation/navigation_core.js
@@ -465,6 +465,37 @@
}]);
});
+ asyncTest( "opening a dialog, closing it, moving forward, and opening it again, does not result in a dialog that needs to be closed twice ", function() {
+ $.testHelper.pageSequence([
+ // setup
+ function(){ $.testHelper.openPage("#dialog-double-hash-test"); },
+
+ // transition to the dialog
+ function(){ $("#dialog-double-hash-test a").click(); },
+
+ // close the dialog
+ function(){ $("#dialog-double-hash-test-dialog a").click(); },
+
+ // Go forward
+ function(){ window.history.forward(); },
+
+ // transition to the dialog
+ function(){ $("#dialog-double-hash-test a").click(); },
+
+ // close the dialog
+ function(){
+ $("#dialog-double-hash-test-dialog a").click();
+ },
+
+ // make sure the dialog is closed
+ function() {
+ setTimeout( function() {
+ same($("#dialog-double-hash-test")[0], $.mobile.activePage[0], "should be back to the test page");
+ }, 300);
+ start();
+ }]);
+ });
+
asyncTest( "going back from a dialog triggered from a dialog should result in the first dialog ", function(){
$.testHelper.pageSequence([
// setup
Please sign in to comment.
Something went wrong with that request. Please try again.