Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[unit tests] Add unit test for dialog double hash fix -- Re: #2656 #4131

Merged
merged 1 commit into from

4 participants

@gabrielschulhof
Collaborator

No description provided.

@gseguin gseguin merged commit 047e1dd into jquery:master
@johnbender

I fixed the build by moving the start into the timeout - the same call was running after the next test had started. Timing is a bitch :(

Either way I'm curious why the timeout is necessary at all, the pagechange event should be firing after the dialog has gone away. Any chance you'll look into that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.