Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39cdb8c

Browse files
committed
Ajax: don't expect cross-origin tests run in envs which not support it
Follow-up tob078a62
1 parent239169b commit39cdb8c

File tree

1 file changed

+20
-31
lines changed

1 file changed

+20
-31
lines changed

‎test/unit/ajax.js

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,6 @@ QUnit.module( "ajax", {
7171
};
7272
});
7373

74-
ajaxTest("jQuery.ajax() - do not execute js (crossOrigin)",2,function(assert){
75-
return{
76-
create:function(options){
77-
options.crossDomain=true;
78-
returnjQuery.ajax(url("data/script.php?header=ecma"),options);
79-
},
80-
success:function(){
81-
assert.ok(true,"success");
82-
},
83-
complete:function(){
84-
assert.ok(true,"complete");
85-
}
86-
};
87-
});
88-
8974
ajaxTest("jQuery.ajax() - execute js for crossOrigin when dataType option is provided",3,
9075
function(assert){
9176
return{
@@ -113,6 +98,11 @@ QUnit.module( "ajax", {
11398
success:function(){
11499
assert.ok(true,"success");
115100
},
101+
fail:function(){
102+
if(jQuery.support.cors===false){
103+
assert.ok(true,"fail");
104+
}
105+
},
116106
complete:function(){
117107
assert.ok(true,"complete");
118108
}
@@ -1777,22 +1767,21 @@ QUnit.module( "ajax", {
17771767
done:function(data){
17781768
assert.ok(false,"done: "+data);
17791769
},
1780-
fail:function(jqXHR,status,error){
1781-
assert.ok(true,"exception caught: "+error);
1782-
assert.strictEqual(jqXHR.status,0,"proper status code");
1783-
assert.strictEqual(status,"error","proper status");
1784-
}
1785-
},{
1786-
url:"http://domain.org:80d",
1787-
done:function(data){
1788-
assert.ok(false,"done: "+data);
1789-
},
1790-
fail:function(_,status,error){
1791-
assert.ok(true,"fail: "+status+" - "+error);
1792-
}
1793-
}];
1794-
}
1795-
);
1770+
fail:function(jqXHR,status,error){
1771+
assert.ok(true,"exception caught: "+error);
1772+
assert.strictEqual(jqXHR.status,0,"proper status code");
1773+
assert.strictEqual(status,"error","proper status");
1774+
}
1775+
},{
1776+
url:"http://domain.org:80d",
1777+
done:function(data){
1778+
assert.ok(false,"done: "+data);
1779+
},
1780+
fail:function(_,status,error){
1781+
assert.ok(true,"fail: "+status+" - "+error);
1782+
}
1783+
}];
1784+
});
17961785

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp