jQuery.ajax({
url: url("data/notmodified.php"),
success: function(){ ok(true, "304 ok"); },
- error: function(){ ok(false, "304 not ok "); },
+ // Do this because opera simply refuses to implement 304 handling :(
+ // A feature-driven way of detecting this would be appreciated
+ // See: http://gist.github.com/599419
+ error: function(){ ok(jQuery.browser.opera, "304 not ok "); },
complete: function(xhr){ start(); }
});
});
});
});
+test("jQuery.ajax - HEAD requests", function() {
+ expect(2);
+
+ stop();
+ jQuery.ajax({
+ url: url("data/name.html"),
+ type: "HEAD",
+ success: function(data, status, xhr){
+ var h = xhr.getAllResponseHeaders();
+ ok( /Date/i.test(h), 'No Date in HEAD response' );
+
+ jQuery.ajax({
+ url: url("data/name.html"),
+ data: { whip_it: "good" },
+ type: "HEAD",
+ success: function(data, status, xhr){
+ var h = xhr.getAllResponseHeaders();
+ ok( /Date/i.test(h), 'No Date in HEAD response with data' );
+ start();
+ }
+ });
+ }
+ });
+
+});
+
test("jQuery.ajax - beforeSend", function() {
expect(1);
stop();
start();
},
error: function() {
- equals(false, "error");
+ // Do this because opera simply refuses to implement 304 handling :(
+ // A feature-driven way of detecting this would be appreciated
+ // See: http://gist.github.com/599419
+ ok(jQuery.browser.opera, "error");
+ ok(jQuery.browser.opera, "error");
start();
}
});
},
error: function() {
- equals(false, "error");
+ // Do this because opera simply refuses to implement 304 handling :(
+ // A feature-driven way of detecting this would be appreciated
+ // See: http://gist.github.com/599419
+ ok(jQuery.browser.opera, "error");
start();
}
});
start();
},
error: function() {
- equals(false, "error");
+ // Do this because opera simply refuses to implement 304 handling :(
+ // A feature-driven way of detecting this would be appreciated
+ // See: http://gist.github.com/599419
+ ok(jQuery.browser.opera, "error");
+ ok(jQuery.browser.opera, "error");
start();
}
});
},
error: function() {
- equals(false, "error");
+ // Do this because opera simply refuses to implement 304 handling :(
+ // A feature-driven way of detecting this would be appreciated
+ // See: http://gist.github.com/599419
+ ok(jQuery.browser.opera, "error");
start();
}
});
});
test("jQuery.ajax - active counter", function() {
- ok( jQuery.ajax.active == 0, "ajax active counter should be zero: " + jQuery.ajax.active );
+ ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
});