Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[navigation unit tests] Test base tag correctness after returning fro…

…m a stale dialogHashKey history entry
  • Loading branch information...
commit 9c4f2264181ea9f524b2fac869b9c9a06f964a06 1 parent 49e5589
@gabrielschulhof gabrielschulhof authored
View
4 tests/unit/navigation/index.html
@@ -207,6 +207,10 @@ <h2 id="qunit-userAgent"></h2>
<a href="dialog-param-test/dialog-param.html">go</a>
</div>
+<div data-nstest-role="page" id="dialog-base-tag-test-page">
+ <a href="go-to-dialog.html">go</a>
+</div>
+
<div data-nstest-role="page" id="pathing-tests">
<!-- doc rel links -->
<a href="file.html" id="doc-rel-test-one">go</a>
View
40 tests/unit/navigation/navigation_core.js
@@ -445,6 +445,46 @@
}]);
});
+ asyncTest( "going back from a stale dialog history entry does not cause the base tag to be reset", function() {
+
+ var baseHRef;
+
+ expect( 1 );
+
+ $.testHelper.pageSequence([
+ // setup
+ function() { $.testHelper.openPage( "#dialog-base-tag-test-page" ); },
+
+ // go to page that launches dialog
+ function() { $( "#dialog-base-tag-test-page a" ).click(); },
+
+ // record the base href and launch the dialog
+ function() {
+ baseHRef = $( "base" ).attr( "href" );
+ $( "a#go-to-dialog" ).click();
+ },
+
+ // close the dialog - this assumes a close button link will be added to the dialog as part of the enhancement process
+ function() { $( "#dialog-base-tag-test a" ).click(); },
+
+ function() {
+ $.testHelper.sequence([
+ // Go forward to reach the now-stale dialogHashKey history entry
+ function() { window.history.forward(); },
+
+ // Go back
+ function() { window.history.back(); },
+
+ // Make sure the base href is unchanged from the recorded value
+ function() {
+ deepEqual( $( "base" ).attr( "href" ), baseHRef, "href of base tag is unchanged" );
+ start();
+ }
+ ], 2000);
+ }
+ ]);
+ });
+
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
Please sign in to comment.
Something went wrong with that request. Please try again.