@@ -578,6 +578,7 @@ QUnit.test("abort", function (assert) {
578578 this . send = function ( ) { } ;
579579 this . abort = function ( ) {
580580 assert . ok ( true , 'called the underlying XHR.abort' ) ;
581+ restore ( ) ;
581582 done ( ) ;
582583 } ;
583584 } ) ;
@@ -614,7 +615,10 @@ QUnit.test("abort prevents sending if beforeSend is not finished", function (ass
614615
615616 request . abort ( ) ;
616617
617- setTimeout ( done , 10 ) ;
618+ setTimeout ( function ( ) {
619+ restore ( ) ;
620+ done ( ) ;
621+ } , 10 ) ;
618622} ) ;
619623
620624QUnit . test ( "beforeSend" , function ( assert ) {
@@ -692,7 +696,10 @@ QUnit.test("beforeSend async", function (assert) {
692696 assert . ok ( headers . hasOwnProperty ( 'Authorization' ) , "authorization header set" ) ;
693697 } , function ( reason ) {
694698 assert . notOk ( reason , "request failed with reason = " , reason ) ;
695- } ) . then ( done ) ;
699+ } ) . then ( function ( ) {
700+ restore ( ) ;
701+ done ( ) ;
702+ } ) ;
696703} ) ;
697704
698705QUnit . test ( "beforeSend rejects the ajax promise on failure" , function ( assert ) {
@@ -720,7 +727,10 @@ QUnit.test("beforeSend rejects the ajax promise on failure", function (assert) {
720727 } , function ( reason ) {
721728 assert . ok ( true , "request rejected" ) ;
722729 assert . equal ( reason , error , "error is what we expect" ) ;
723- } ) . then ( done ) ;
730+ } ) . then ( function ( ) {
731+ restore ( ) ;
732+ done ( ) ;
733+ } ) ;
724734} ) ;
725735
726736QUnit . test ( "async should be always true #51" , function ( assert ) {
@@ -742,7 +752,7 @@ QUnit.test("async should be always true #51", function(assert){
742752 headers [ header ] = value ;
743753 } ;
744754 } ) ;
745-
755+
746756 ajax ( {
747757 type : "get" ,
748758 url : "/ep"
0 commit comments