aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-10-13 00:00:38 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-10-13 00:02:17 +0300
commit905ab09afcead6498c1ffc2f82218c51b55352a0 (patch)
treea74c503ae5d6a2db931b6e8c95e6fe7d1b788c90
parent3ced5abe5c7e4c90f845012859108059b03770c0 (diff)
downloadjquery-905ab09afcead6498c1ffc2f82218c51b55352a0.tar.gz
jquery-905ab09afcead6498c1ffc2f82218c51b55352a0.zip
Ajax: don't expect cross-origin tests run in envs which not support it
Cherry-picked from 39cdb8c9aa0fde68f733553ba050a2ba9d86474c Follow-up to b078a62013782c7424a4a61a240c23c4c0b42614
-rw-r--r--test/unit/ajax.js51
1 files changed, 20 insertions, 31 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 62d06c9b4..1c5b0b0a7 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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 {
@@ -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" );
}
@@ -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 {