From 489fc19fb1c212494fa43983bf72bad7c70bea4e Mon Sep 17 00:00:00 2001 From: Kin Blas Date: Thu, 2 Jun 2011 16:52:36 -0700 Subject: [PATCH] Unit test to catch issues like 1767. - Test passing string as data option to changePage(). - Test passing object as data option to changePage(). --- .../form-tests/changepage-data.html | 8 ++++ tests/unit/navigation/navigation_core.js | 37 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/unit/navigation/form-tests/changepage-data.html 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);