This repository was archived by the owner on Oct 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -1030,8 +1030,8 @@ define( [
10301030 options . duplicateCachedPage = dupCachedPage ;
10311031
10321032 // store the original absolute url so that it can be provided
1033- // to events in the triggerData
1034- newPage . data ( 'absUrl' , triggerData . url ) ;
1033+ // to events in the triggerData of the subsequent changePage call
1034+ newPage . data ( 'absUrl' , triggerData . absUrl ) ;
10351035 $ . mobile . changePage ( newPage , options ) ;
10361036 } )
10371037 . fail ( function ( url , options ) {
Original file line number Diff line number Diff line change 13121312 }
13131313 ] ) ;
13141314 } ) ;
1315+
1316+
1317+ var absHomeUrl = $ . mobile . path . parseLocation ( ) . hrefNoHash ,
1318+ homeDomain = $ . mobile . path . parseLocation ( ) . domain ;
1319+
1320+ asyncTest ( "page load events are providided with the absolute url for the content" , function ( ) {
1321+ var requestPath ;
1322+
1323+ expect ( 3 ) ;
1324+
1325+ $ ( document ) . one ( "pagebeforechange" , function ( event , data ) {
1326+ equal ( data . absUrl , absHomeUrl + "#bar" ) ;
1327+ } ) ;
1328+
1329+ $ ( document ) . one ( "pagechange" , function ( event , data ) {
1330+ equal ( data . absUrl , absHomeUrl + "#bar" ) ;
1331+ } ) ;
1332+
1333+ $ . mobile . changePage ( "#bar" ) ;
1334+
1335+ requestPath = "/theres/no/way/this/page/exists.html" ;
1336+
1337+ $ ( document ) . one ( "pagechangefailed" , function ( event , data ) {
1338+ equal ( data . absUrl , homeDomain + requestPath ) ;
1339+ start ( ) ;
1340+ } ) ;
1341+
1342+ $ . mobile . changePage ( requestPath ) ;
1343+ } ) ;
13151344} ) ( jQuery ) ;
You can’t perform that action at this time.
0 commit comments