aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorDavid Serduke <davidserduke@gmail.com>2007-12-04 04:43:45 +0000
committerDavid Serduke <davidserduke@gmail.com>2007-12-04 04:43:45 +0000
commitaee221d33c2db2c76639dabeca2b1e3d022e348e (patch)
tree34f4ed0cb005ace6c9fff31c91e6235b5b280d48 /test/unit/ajax.js
parent701b072e1a104bce03df700c5f620d4000ccd573 (diff)
downloadjquery-aee221d33c2db2c76639dabeca2b1e3d022e348e.tar.gz
jquery-aee221d33c2db2c76639dabeca2b1e3d022e348e.zip
Fixed #1999 by replacing the 'no-cache' parameter if it is there instead of just appending.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 2b3cfb656..5274b6850 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -226,7 +226,7 @@ test("pass-through request object", function() {
var success = function() {
// Re-enabled because a bug was found in the unit test that probably caused the problem
if(++count == 5)
- start();
+ start();
};
ok( $.get(url(target), success), "get" );
@@ -236,6 +236,36 @@ test("pass-through request object", function() {
ok( $.ajax({url: url(target), success: success}), "generic" );
});
+test("ajax cache", function () {
+ expect(18);
+ stop();
+
+ var count = 0;
+
+ $("#firstp").bind("ajaxSuccess", function (e, xml, s) {
+ var re = /_=(.*?)(&|$)/g;
+ var oldOne = null;
+ for (var i = 0; i < 6; i++) {
+ var ret = re.exec(s.url);
+ if (!ret) {
+ break;
+ }
+ oldOne = ret[1];
+ }
+ equals(i, 1, "Test to make sure only one 'no-cache' parameter is there");
+ ok(oldOne != "tobereplaced555", "Test to be sure parameter (if it was there) was replaced");
+ if(++count == 6)
+ start();
+ });
+
+ ok( $.ajax({url: "data/text.php", cache:false}), "test with no parameters" );
+ ok( $.ajax({url: "data/text.php?pizza=true", cache:false}), "test with 1 parameter" );
+ ok( $.ajax({url: "data/text.php?_=tobereplaced555", cache:false}), "test with _= parameter" );
+ ok( $.ajax({url: "data/text.php?pizza=true&_=tobereplaced555", cache:false}), "test with 1 parameter plus _= one" );
+ ok( $.ajax({url: "data/text.php?_=tobereplaced555&tv=false", cache:false}), "test with 1 parameter plus _= one before it" );
+ ok( $.ajax({url: "data/text.php?name=David&_=tobereplaced555&washere=true", cache:false}), "test with 2 parameters surrounding _= one" );
+});
+
test("global ajaxSettings", function() {
expect(3);