Unit test to catch issues like 1767.

- Test passing string as data option to changePage().
- Test passing object as data option to changePage().
This commit is contained in:
Kin Blas 2011-06-02 16:52:36 -07:00
parent b31825a1d7
commit 489fc19fb1
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="changepage-data" data-nstest-role="page"> </div>
</body>
</html>

View file

@ -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);