Add some abort() Ajax tests. Verifies that #3984 works.
authorjeresig <jeresig@gmail.com>
Wed, 6 Jan 2010 17:13:56 +0000 (12:13 -0500)
committerjeresig <jeresig@gmail.com>
Wed, 6 Jan 2010 17:13:56 +0000 (12:13 -0500)
test/unit/ajax.js

index 9b1e323..3393780 100644 (file)
@@ -70,6 +70,30 @@ test("jQuery.ajax() - error callbacks", function() {
        });
 });
 
+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(6);