Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix for pagechange value and test of 3 page change events

  • Loading branch information...
commit d7dc1f3547de20a3bbc24ac6e5bb8675fe47479d 1 parent 9b6cd5b
@johnbender johnbender authored
View
4 js/jquery.mobile.navigation.js
@@ -1030,8 +1030,8 @@ define( [
options.duplicateCachedPage = dupCachedPage;
// store the original absolute url so that it can be provided
- // to events in the triggerData
- newPage.data( 'absUrl', triggerData.url );
+ // to events in the triggerData of the subsequent changePage call
+ newPage.data( 'absUrl', triggerData.absUrl );
$.mobile.changePage( newPage, options );
})
.fail(function( url, options ) {
View
29 tests/unit/navigation/navigation_core.js
@@ -1312,4 +1312,33 @@
}
]);
});
+
+
+ var absHomeUrl = $.mobile.path.parseLocation().hrefNoHash,
+ homeDomain = $.mobile.path.parseLocation().domain;
+
+ asyncTest( "page load events are providided with the absolute url for the content", function() {
+ var requestPath;
+
+ expect( 3 );
+
+ $( document ).one( "pagebeforechange", function( event, data ) {
+ equal( data.absUrl, absHomeUrl + "#bar");
+ });
+
+ $( document ).one( "pagechange", function( event, data ) {
+ equal( data.absUrl, absHomeUrl + "#bar" );
+ });
+
+ $.mobile.changePage( "#bar" );
+
+ requestPath = "/theres/no/way/this/page/exists.html";
+
+ $( document ).one( "pagechangefailed", function( event, data ) {
+ equal( data.absUrl, homeDomain + requestPath );
+ start();
+ });
+
+ $.mobile.changePage( requestPath );
+ });
})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.