});
test("jQuery.ajax() - abort", function() {
- expect( 6 );
+ expect( 8 );
stop();
jQuery('#foo').ajaxStart(function(){
complete: function(){ ok(true, "complete"); }
});
+ equals( xhr.readyState, 1, "XHR readyState indicates successful dispatch" );
+
xhr.abort();
+ equals( xhr.readyState, 0, "XHR readyState indicates successful abortion" );
});
test("Ajax events with context", function() {
});
});
+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();
});
test("jQuery.ajax() - JSONP, Local", function() {
- expect(8);
+ expect(9);
var count = 0;
- function plus(){ if ( ++count == 8 ) start(); }
+ function plus(){ if ( ++count == 9 ) start(); }
stop();
plus();
}
});
+
+ //#7578
+ jQuery.ajax({
+ url: "data/jsonp.php",
+ dataType: "jsonp",
+ beforeSend: function(){
+ strictEqual( this.cache, false, "cache must be false on JSON request" );
+ plus();
+ return false;
+ }
+ });
});
test("JSONP - Custom JSONP Callback", function() {
});
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 );
});
+test( "jQuery.ajax - Location object as url (#7531)", 1, function () {
+ var success = false;
+ try {
+ var xhr = jQuery.ajax({ url: document.location });
+ success = true;
+ xhr.abort();
+ } catch (e) {}
+
+ ok( success, "document.location did not generate exception" );
+});
}