🌐 AI搜索 & 代理 主页
Skip to content

Commit 0d891c2

Browse files
Move Cors unit from core to ajax
1 parent b733fc5 commit 0d891c2

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

test/unit/ajax.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,32 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
28402840
} );
28412841
} );
28422842

2843+
QUnit.test( "jQuery.append with crossOrigin attribute", function( assert ) {
2844+
var done = assert.async();
2845+
assert.expect( 1 );
2846+
2847+
var timeout = null;
2848+
2849+
Globals.register( "corsCallback" );
2850+
window.corsCallback = function( response ) {
2851+
assert.ok( response === true, "Cors" );
2852+
window.clearTimeout( timeout );
2853+
done();
2854+
};
2855+
2856+
var src = baseURL + "mock.php?action=cors";
2857+
2858+
// To simulate a cross-origin request
2859+
src = src.replace( "localhost", "127.0.0.1" );
2860+
var html = "<script type=\"text/javascript\" src=\"" + src + "\" crossorigin=\"anonymous\"><\/script>";
2861+
2862+
jQuery( document.body ).append( html );
2863+
timeout = window.setTimeout( function() {
2864+
assert.ok( false, "Cors" );
2865+
done();
2866+
}, 2000 );
2867+
} );
2868+
28432869
//----------- jQuery.active
28442870

28452871
QUnit.test( "jQuery.active", function( assert ) {

test/unit/core.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -197,32 +197,6 @@ QUnit.test( "globalEval execution after script injection (#7862)", function( ass
197197
assert.ok( window.strictEvalTest - now < 500, "Code executed synchronously" );
198198
} );
199199

200-
QUnit.test( "jQuery.append with crossOrigin attribute", function( assert ) {
201-
var done = assert.async();
202-
assert.expect( 1 );
203-
204-
var timeout = null;
205-
206-
Globals.register( "corsCallback" );
207-
window.corsCallback = function( response ) {
208-
assert.ok( response === true, "Cors" );
209-
window.clearTimeout( timeout );
210-
done();
211-
};
212-
213-
var src = baseURL + "mock.php?action=cors";
214-
215-
// To simulate a cross-origin request
216-
src = src.replace( "localhost", "127.0.0.1" );
217-
var html = "<script type=\"text/javascript\" src=\"" + src + "\" crossorigin=\"anonymous\"><\/script>";
218-
219-
jQuery( document.body ).append( html );
220-
timeout = window.setTimeout( function() {
221-
assert.ok( false, "Cors" );
222-
done();
223-
}, 2000 );
224-
} );
225-
226200
QUnit.test( "noConflict", function( assert ) {
227201
assert.expect( 7 );
228202

0 commit comments

Comments
 (0)