Skip to content

Commit

Permalink
Ajax: don't expect cross-origin tests run in envs which not support it
Browse files Browse the repository at this point in the history
Cherry-picked from 39cdb8c
Follow-up to b078a62
  • Loading branch information
markelog committed Oct 12, 2015
1 parent 3ced5ab commit 905ab09
Showing 1 changed file with 20 additions and 31 deletions.
51 changes: 20 additions & 31 deletions test/unit/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,6 @@ QUnit.module( "ajax", {
};
} );

ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
return {
create: function( options ) {
options.crossDomain = true;
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
},
success: function() {
assert.ok( true, "success" );
},
complete: function() {
assert.ok( true, "complete" );
}
};
} );

ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
function( assert ) {
return {
Expand Down Expand Up @@ -127,6 +112,11 @@ QUnit.module( "ajax", {
success: function() {
assert.ok( true, "success" );
},
fail: function() {
if (jQuery.support.cors === false) {
assert.ok( true, "fail" );
}
},
complete: function() {
assert.ok( true, "complete" );
}
Expand Down Expand Up @@ -1613,22 +1603,21 @@ QUnit.module( "ajax", {
done: function( data ) {
assert.ok( false, "done: " + data );
},
fail: function( jqXHR, status, error ) {
assert.ok( true, "exception caught: " + error );
assert.strictEqual( jqXHR.status, 0, "proper status code" );
assert.strictEqual( status, "error", "proper status" );
}
}, {
url: "http://domain.org:80d",
done: function( data ) {
assert.ok( false, "done: " + data );
},
fail: function( _, status, error ) {
assert.ok( true, "fail: " + status + " - " + error );
}
} ];
}
);
fail: function( jqXHR, status, error ) {
assert.ok( true, "exception caught: " + error );
assert.strictEqual( jqXHR.status, 0, "proper status code" );
assert.strictEqual( status, "error", "proper status" );
}
}, {
url: "http://domain.org:80d",
done: function( data ) {
assert.ok( false, "done: " + data );
},
fail: function( _, status, error ) {
assert.ok( true, "fail: " + status + " - " + error );
}
} ];
} );

ajaxTest( "gh-2587 - when content-type not xml, but looks like one", 1, function( assert ) {
return {
Expand Down

0 comments on commit 905ab09

Please sign in to comment.