]> source.dussan.org Git - jquery.git/commitdiff
Added a test for retrying a request on error using jQuery.ajax(this). Works as intend...
authorjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 05:19:27 +0000 (06:19 +0100)
committerjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 05:19:27 +0000 (06:19 +0100)
test/unit/ajax.js

index 14f8928572bd90963401f5f01594a342b57dcf9d..4c8c5009be66ffb4fbd74e861bc13e1ec3a894bf 100644 (file)
@@ -257,6 +257,29 @@ test("jQuery.ajax() - responseText on error", function() {
        });
 });
 
+test(".ajax() - retry with jQuery.ajax( this )", function() {
+
+       expect( 1 );
+
+       stop();
+
+       var firstTime = 1;
+
+       jQuery.ajax({
+               url: url("data/errorWithText.php"),
+               error: function() {
+                       if ( firstTime ) {
+                               firstTime = 0;
+                               jQuery.ajax( this );
+                       } else {
+                               ok( true , "Test retrying with jQuery.ajax(this) works" );
+                               start();
+                       }
+               }
+       })
+
+});
+
 test(".ajax() - headers" , function() {
 
        expect( 2 );