diff --git a/tests/unit/navigation/form-tests/changepage-data.html b/tests/unit/navigation/form-tests/changepage-data.html new file mode 100644 index 00000000..2305c206 --- /dev/null +++ b/tests/unit/navigation/form-tests/changepage-data.html @@ -0,0 +1,8 @@ + + + + + +
+ + diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index d67aa12e..13238dd2 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -422,4 +422,41 @@ } ], 1000); }); + + asyncTest( "query data passed as string to changePage is appended to URL", function(){ + + $.testHelper.pageSequence([ + // open our test page + function(){ + $.mobile.changePage( "form-tests/changepage-data.html", { + data: "foo=1&bar=2" + } ); + }, + + function(){ + same(location.hash, "#form-tests/changepage-data.html?foo=1&bar=2"); + start(); + } + ]); + }); + + asyncTest( "query data passed as object to changePage is appended to URL", function(){ + + $.testHelper.pageSequence([ + // open our test page + function(){ + $.mobile.changePage( "form-tests/changepage-data.html", { + data: { + foo: 3, + bar: 4 + } + } ); + }, + + function(){ + same(location.hash, "#form-tests/changepage-data.html?foo=3&bar=4"); + start(); + } + ]); + }); })(jQuery);