+
+ stop();
+
+ jQuery('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( false, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( true, "ajaxSuccess" );
+ });
+
+ jQuery.ajax({
+ url: url("data/name.html"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(true, "success"); },
+ error: function(){ ok(false, "error"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+});
+
+test("jQuery.ajax() - error callbacks", function() {
+ expect( 8 );
+ stop();
+
+ jQuery('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( true, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( false, "ajaxSuccess" );
+ });
+
+ jQuery.ajaxSetup({ timeout: 500 });
+
+ jQuery.ajax({
+ url: url("data/name.php?wait=5"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(false, "success"); },
+ error: function(){ ok(true, "error"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+});
+
+test(".ajax() - hash", function() {
+ expect(3);
+
+ jQuery.ajax({
+ url: "data/name.html#foo",
+ beforeSend: function( xhr, settings ) {
+ equals(settings.url, "data/name.html", "Make sure that the URL is trimmed.");
+ return false;
+ }
+ });
+
+ jQuery.ajax({
+ url: "data/name.html?abc#foo",
+ beforeSend: function( xhr, settings ) {
+ equals(settings.url, "data/name.html?abc", "Make sure that the URL is trimmed.");
+ return false;
+ }
+ });
+
+ jQuery.ajax({
+ url: "data/name.html?abc#foo",
+ data: { "test": 123 },
+ beforeSend: function( xhr, settings ) {
+ equals(settings.url, "data/name.html?abc&test=123", "Make sure that the URL is trimmed.");
+ return false;
+ }
+ });
+});
+
+test(".ajax() - 304", function() {
+ expect( 1 );
+ stop();
+
+ jQuery.ajax({
+ url: url("data/notmodified.php"),
+ success: function(){ ok(true, "304 ok"); },
+ error: function(){ ok(false, "304 not ok "); },
+ complete: function(xhr){ start(); }
+ });
+});
+
+test(".load()) - 404 error callbacks", function() {
+ expect( 6 );
+ stop();
+
+ jQuery('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( true, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( false, "ajaxSuccess" );
+ });
+
+ jQuery("<div/>").load("data/404.html", function(){
+ ok(true, "complete");
+ });
+});
+
+test("jQuery.ajax() - abort", function() {
+ expect( 6 );
+ stop();
+
+ jQuery('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ });
+
+ var xhr = jQuery.ajax({
+ url: url("data/name.php?wait=5"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+
+ xhr.abort();
+});
+
+test("Ajax events with context", function() {
+ expect(14);