mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Revert "228ab3d followup 1: fix test failures. Close gh-1056."
This reverts commit 20608b3579
.
This commit is contained in:
parent
20608b3579
commit
7f7007dffe
@ -64,11 +64,11 @@ function createComplexHTML() {
|
|||||||
testFoo = "foo"; jQuery("#foo").html("foo"); \
|
testFoo = "foo"; jQuery("#foo").html("foo"); \
|
||||||
ok( true, "inline script executed" ); \
|
ok( true, "inline script executed" ); \
|
||||||
/* ]]> */</script> \
|
/* ]]> */</script> \
|
||||||
<script src="' + service("echo/", {
|
<script src="' + service("echo", {
|
||||||
content: 'var testBar = "bar"; \
|
content: 'var testBar = "bar"; \
|
||||||
jQuery("#ap").html("bar"); \
|
jQuery("#ap").html("bar"); \
|
||||||
ok( true, "remote script executed");'
|
ok( true, "remote script executed");'
|
||||||
}).replace( /&/g, "&" ) + '"></script> \
|
}) + '"></script> \
|
||||||
blabla';
|
blabla';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,10 +158,10 @@ function url( value ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function service( value, data ) {
|
function service( value, data ) {
|
||||||
var fragment = url( "data/ajax/" + value );
|
var fragment = url( "data/ajax/" + ( value || "" ) );
|
||||||
if ( data ) {
|
if ( data ) {
|
||||||
if ( typeof data !== "string" ) {
|
if ( typeof data !== "string" ) {
|
||||||
data = jQuery.param( data, false );
|
data = jQuery.param( data );
|
||||||
}
|
}
|
||||||
fragment += "&" + data;
|
fragment += "&" + data;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - GET", 1, {
|
ajaxTest( "jQuery.ajax() - GET", 1, {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "bar"
|
content: "bar"
|
||||||
},
|
},
|
||||||
@ -63,7 +63,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - success", 8, {
|
ajaxTest( "jQuery.ajax() - success", 8, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
},
|
},
|
||||||
@ -78,7 +78,7 @@ module( "ajax", {
|
|||||||
ajaxTest( "jQuery.ajax() - success - (url, options)", 8, {
|
ajaxTest( "jQuery.ajax() - success - (url, options)", 8, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
||||||
create: function( options ) {
|
create: function( options ) {
|
||||||
return jQuery.ajax( service("echo/"), options );
|
return jQuery.ajax( service("echo"), options );
|
||||||
},
|
},
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
@ -93,7 +93,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - success - late binding", 8, {
|
ajaxTest( "jQuery.ajax() - success - late binding", 8, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
},
|
},
|
||||||
@ -111,7 +111,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - success - oncomplete binding", 8, {
|
ajaxTest( "jQuery.ajax() - success - oncomplete binding", 8, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
},
|
},
|
||||||
@ -129,7 +129,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - error", 8, {
|
ajaxTest( "jQuery.ajax() - error", 8, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"),
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
},
|
},
|
||||||
@ -143,7 +143,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - abort - textStatus and errorThrown values", 4, [
|
ajaxTest( "jQuery.ajax() - abort - textStatus and errorThrown values", 4, [
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
delay: 1
|
delay: 1
|
||||||
},
|
},
|
||||||
@ -156,7 +156,7 @@ module( "ajax", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
delay: 1
|
delay: 1
|
||||||
},
|
},
|
||||||
@ -171,7 +171,7 @@ module( "ajax", {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - error - responseText", 1, {
|
ajaxTest( "jQuery.ajax() - error - responseText", 1, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
status: 400,
|
status: 400,
|
||||||
content: "plain text message"
|
content: "plain text message"
|
||||||
@ -185,7 +185,7 @@ module( "ajax", {
|
|||||||
var previousUrl,
|
var previousUrl,
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
error: function() {
|
error: function() {
|
||||||
if ( firstTime ) {
|
if ( firstTime ) {
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
@ -193,7 +193,7 @@ module( "ajax", {
|
|||||||
} else {
|
} else {
|
||||||
ok ( true, "Test retrying with jQuery.ajax(this) works" );
|
ok ( true, "Test retrying with jQuery.ajax(this) works" );
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
data: {
|
data: {
|
||||||
"x": 1
|
"x": 1
|
||||||
},
|
},
|
||||||
@ -221,7 +221,7 @@ module( "ajax", {
|
|||||||
xhr.setRequestHeader( "ajax-send", "test" );
|
xhr.setRequestHeader( "ajax-send", "test" );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
url: service("headers/request/"),
|
url: service("headers/request"),
|
||||||
data: {
|
data: {
|
||||||
headers: "siMPle,SometHing-elsE,OthEr,ajax-send"
|
headers: "siMPle,SometHing-elsE,OthEr,ajax-send"
|
||||||
},
|
},
|
||||||
@ -251,7 +251,7 @@ module( "ajax", {
|
|||||||
xhr.setRequestHeader( "ajax-send", "test" );
|
xhr.setRequestHeader( "ajax-send", "test" );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
url: service("headers/response/"),
|
url: service("headers/response"),
|
||||||
data: {
|
data: {
|
||||||
"Sample-Header": "sample value",
|
"Sample-Header": "sample value",
|
||||||
"Sample-Header2": "sample value 2",
|
"Sample-Header2": "sample value 2",
|
||||||
@ -271,7 +271,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - headers - Accept", 1, {
|
ajaxTest( "jQuery.ajax() - headers - Accept", 1, {
|
||||||
url: service("headers/request/"),
|
url: service("headers/request"),
|
||||||
data: {
|
data: {
|
||||||
headers: "accept"
|
headers: "accept"
|
||||||
},
|
},
|
||||||
@ -288,7 +288,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - headers - contentType option", 2, [
|
ajaxTest( "jQuery.ajax() - headers - contentType option", 2, [
|
||||||
{
|
{
|
||||||
url: service("headers/request/"),
|
url: service("headers/request"),
|
||||||
data: {
|
data: {
|
||||||
headers: "content-type"
|
headers: "content-type"
|
||||||
},
|
},
|
||||||
@ -298,7 +298,7 @@ module( "ajax", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: service("headers/request/"),
|
url: service("headers/request"),
|
||||||
data: {
|
data: {
|
||||||
headers: "content-type"
|
headers: "content-type"
|
||||||
},
|
},
|
||||||
@ -404,7 +404,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - abort", 9, {
|
ajaxTest( "jQuery.ajax() - abort", 9, {
|
||||||
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"),
|
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"),
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
delay: 1
|
delay: 1
|
||||||
},
|
},
|
||||||
@ -452,12 +452,12 @@ module( "ajax", {
|
|||||||
}, 0 );
|
}, 0 );
|
||||||
},
|
},
|
||||||
requests: [{
|
requests: [{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
beforeSend: callback("beforeSend"),
|
beforeSend: callback("beforeSend"),
|
||||||
success: callback("success"),
|
success: callback("success"),
|
||||||
complete: callback("complete")
|
complete: callback("complete")
|
||||||
}, {
|
}, {
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
beforeSend: callback("beforeSend"),
|
beforeSend: callback("beforeSend"),
|
||||||
error: callback("error"),
|
error: callback("error"),
|
||||||
complete: callback("complete")
|
complete: callback("complete")
|
||||||
@ -472,7 +472,7 @@ module( "ajax", {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
beforeSend: nocallback("beforeSend"),
|
beforeSend: nocallback("beforeSend"),
|
||||||
error: nocallback("error"),
|
error: nocallback("error"),
|
||||||
complete: nocallback("complete")
|
complete: nocallback("complete")
|
||||||
@ -480,7 +480,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - context - modification", 1, {
|
ajaxTest( "jQuery.ajax() - context - modification", 1, {
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
context: {},
|
context: {},
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
this.test = "foo";
|
this.test = "foo";
|
||||||
@ -501,12 +501,12 @@ module( "ajax", {
|
|||||||
strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." );
|
strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." );
|
||||||
},
|
},
|
||||||
requests: [{
|
requests: [{
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
error: function() {
|
error: function() {
|
||||||
strictEqual( this, obj, "Make sure the original object is maintained." );
|
strictEqual( this, obj, "Make sure the original object is maintained." );
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
context: {},
|
context: {},
|
||||||
error: function() {
|
error: function() {
|
||||||
ok( this !== obj, "Make sure overidding context is possible." );
|
ok( this !== obj, "Make sure overidding context is possible." );
|
||||||
@ -518,7 +518,7 @@ module( "ajax", {
|
|||||||
ajaxTest( "jQuery.ajax() - events - disable", 3, {
|
ajaxTest( "jQuery.ajax() - events - disable", 3, {
|
||||||
setup: addGlobalEvents(""),
|
setup: addGlobalEvents(""),
|
||||||
global: false,
|
global: false,
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
ok( true, "beforeSend" );
|
ok( true, "beforeSend" );
|
||||||
},
|
},
|
||||||
@ -531,7 +531,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements", 3, {
|
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements", 3, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
contentType: "text/xml",
|
contentType: "text/xml",
|
||||||
content: createWithFriesXML( true )
|
content: createWithFriesXML( true )
|
||||||
@ -544,7 +544,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements (over JSONP)", 3, {
|
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements (over JSONP)", 3, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: createWithFriesXML( true )
|
content: createWithFriesXML( true )
|
||||||
},
|
},
|
||||||
@ -557,7 +557,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - atom+xml", 2, {
|
ajaxTest( "jQuery.ajax() - atom+xml", 2, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "<root><element /></root>",
|
content: "<root><element /></root>",
|
||||||
contentType: "atom+xml"
|
contentType: "atom+xml"
|
||||||
@ -588,7 +588,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - beforeSend", 1, {
|
ajaxTest( "jQuery.ajax() - beforeSend", 1, {
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
beforeSend: function( xml ) {
|
beforeSend: function( xml ) {
|
||||||
this.check = true;
|
this.check = true;
|
||||||
},
|
},
|
||||||
@ -600,7 +600,7 @@ module( "ajax", {
|
|||||||
ajaxTest( "jQuery.ajax() - beforeSend, cancel request manually", 2, {
|
ajaxTest( "jQuery.ajax() - beforeSend, cancel request manually", 2, {
|
||||||
create: function() {
|
create: function() {
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
url: service("error/"),
|
url: service("error"),
|
||||||
beforeSend: function( xhr ) {
|
beforeSend: function( xhr ) {
|
||||||
ok( true, "beforeSend got called, canceling" );
|
ok( true, "beforeSend got called, canceling" );
|
||||||
xhr.abort();
|
xhr.abort();
|
||||||
@ -627,7 +627,7 @@ module( "ajax", {
|
|||||||
Globals.register("testBar");
|
Globals.register("testBar");
|
||||||
},
|
},
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: createComplexHTML()
|
content: createComplexHTML()
|
||||||
},
|
},
|
||||||
@ -640,7 +640,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - synchronous request", 1, {
|
ajaxTest( "jQuery.ajax() - synchronous request", 1, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "hello world"
|
content: "hello world"
|
||||||
},
|
},
|
||||||
@ -653,7 +653,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - synchronous request - callbacks", 2, {
|
ajaxTest( "jQuery.ajax() - synchronous request - callbacks", 2, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "hello world"
|
content: "hello world"
|
||||||
},
|
},
|
||||||
@ -687,12 +687,12 @@ module( "ajax", {
|
|||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
|
||||||
ok( jQuery.get( service("echo/"), success ), "get" );
|
ok( jQuery.get( service("echo"), success ), "get" );
|
||||||
ok( jQuery.post( service("echo/"), success ), "post" );
|
ok( jQuery.post( service("echo"), success ), "post" );
|
||||||
ok( jQuery.getScript( service("echo/"), success ), "script" );
|
ok( jQuery.getScript( service("echo"), success ), "script" );
|
||||||
ok( jQuery.getJSON( service("echo/?content=0"), success ), "json" );
|
ok( jQuery.getJSON( service("echo?content=0"), success ), "json" );
|
||||||
ok( jQuery.ajax({
|
ok( jQuery.ajax({
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
success: success
|
success: success
|
||||||
}), "generic" );
|
}), "generic" );
|
||||||
});
|
});
|
||||||
@ -759,7 +759,7 @@ module( "ajax", {
|
|||||||
strictEqual( data, "041275", "JSON results returned - " + this.type + " - " + options.title );
|
strictEqual( data, "041275", "JSON results returned - " + this.type + " - " + options.title );
|
||||||
}
|
}
|
||||||
}, options );
|
}, options );
|
||||||
tmp.url = service( "echo/" + ( options.url || "" ) );
|
tmp.url = service( "echo" + ( options.url || "" ) );
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,11 +774,11 @@ module( "ajax", {
|
|||||||
}),
|
}),
|
||||||
request({
|
request({
|
||||||
title: "REST-like",
|
title: "REST-like",
|
||||||
url: "index.php/??"
|
url: "/index.php/??"
|
||||||
}),
|
}),
|
||||||
request({
|
request({
|
||||||
title: "REST-like (with param)",
|
title: "REST-like (with param)",
|
||||||
url: "index.php/???content=\"041275\"",
|
url: "/index.php/???content=\"041275\"",
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
delete this.data;
|
delete this.data;
|
||||||
}
|
}
|
||||||
@ -848,16 +848,19 @@ module( "ajax", {
|
|||||||
ajaxTest( "jQuery.ajax() - JSONP - POST" + label, 3, [
|
ajaxTest( "jQuery.ajax() - JSONP - POST" + label, 3, [
|
||||||
request({
|
request({
|
||||||
title: "no callback",
|
title: "no callback",
|
||||||
type: "POST"
|
type: "POST",
|
||||||
|
url: "/"
|
||||||
}),
|
}),
|
||||||
request({
|
request({
|
||||||
title: "data callback",
|
title: "data callback",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
url: "/",
|
||||||
data: "content=041275&callback=?"
|
data: "content=041275&callback=?"
|
||||||
}),
|
}),
|
||||||
request({
|
request({
|
||||||
title: "data obj callback",
|
title: "data obj callback",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
url: "/",
|
||||||
jsonp: "callback"
|
jsonp: "callback"
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
@ -926,7 +929,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - malformed JSON", 2, {
|
ajaxTest( "jQuery.ajax() - malformed JSON", 2, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "{bad: toTheBone}"
|
content: "{bad: toTheBone}"
|
||||||
},
|
},
|
||||||
@ -944,7 +947,7 @@ module( "ajax", {
|
|||||||
return 42;
|
return 42;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: service("headers/response/"),
|
url: service("headers/response/index.php"),
|
||||||
data: {
|
data: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
@ -959,7 +962,7 @@ module( "ajax", {
|
|||||||
ok( false, "content-type detected" );
|
ok( false, "content-type detected" );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: service("headers/response/"),
|
url: service("headers/response/index.php"),
|
||||||
data: {
|
data: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
@ -972,7 +975,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - JSON - empty", 1, {
|
ajaxTest( "jQuery.ajax() - JSON - empty", 1, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
error: function( _, __, error ) {
|
error: function( _, __, error ) {
|
||||||
strictEqual( typeof error, "object", "error object for empty json response" );
|
strictEqual( typeof error, "object", "error object for empty json response" );
|
||||||
@ -1034,7 +1037,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - statusText", 4, [
|
ajaxTest( "jQuery.ajax() - statusText", 4, [
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: "Hello"
|
statusText: "Hello"
|
||||||
@ -1045,7 +1048,7 @@ module( "ajax", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
status: 404,
|
status: 404,
|
||||||
statusText: "Hello"
|
statusText: "Hello"
|
||||||
@ -1057,7 +1060,7 @@ module( "ajax", {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
jQuery.each( [ service("error/"), service("echo/") ], function( isSuccess, url ) {
|
jQuery.each( [ "error", service("echo") ], function( isSuccess, url ) {
|
||||||
function statusCodes( title ) {
|
function statusCodes( title ) {
|
||||||
return {
|
return {
|
||||||
200: function() {
|
200: function() {
|
||||||
@ -1099,7 +1102,7 @@ module( "ajax", {
|
|||||||
dataType = srcType + " " + dataType;
|
dataType = srcType + " " + dataType;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "\"041275\""
|
content: "\"041275\""
|
||||||
},
|
},
|
||||||
@ -1121,7 +1124,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - overrideMimeType", 2, [
|
ajaxTest( "jQuery.ajax() - overrideMimeType", 2, [
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "42"
|
content: "42"
|
||||||
},
|
},
|
||||||
@ -1133,7 +1136,7 @@ module( "ajax", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "42"
|
content: "42"
|
||||||
},
|
},
|
||||||
@ -1168,7 +1171,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxTest( "#2806 - jQuery.ajax() - data option - evaluate function values", 1, {
|
ajaxTest( "#2806 - jQuery.ajax() - data option - evaluate function values", 1, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: function() {
|
content: function() {
|
||||||
return "value";
|
return "value";
|
||||||
@ -1216,7 +1219,7 @@ module( "ajax", {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
create: function() {
|
create: function() {
|
||||||
return jQuery.ajax( service("echo/") );
|
return jQuery.ajax( service("echo") );
|
||||||
},
|
},
|
||||||
done: function() {
|
done: function() {
|
||||||
ok( true, "With only string URL argument" );
|
ok( true, "With only string URL argument" );
|
||||||
@ -1224,7 +1227,7 @@ module( "ajax", {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
create: function() {
|
create: function() {
|
||||||
return jQuery.ajax( service("echo/"), {});
|
return jQuery.ajax( service("echo"), {});
|
||||||
},
|
},
|
||||||
done: function() {
|
done: function() {
|
||||||
ok( true, "With string URL param and map" );
|
ok( true, "With string URL param and map" );
|
||||||
@ -1234,7 +1237,7 @@ module( "ajax", {
|
|||||||
create: function( options ) {
|
create: function( options ) {
|
||||||
return jQuery.ajax( options );
|
return jQuery.ajax( options );
|
||||||
},
|
},
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
success: function() {
|
success: function() {
|
||||||
ok( true, "With only map" );
|
ok( true, "With only map" );
|
||||||
}
|
}
|
||||||
@ -1243,7 +1246,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
|
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
|
||||||
ajaxTest( "#8205 - jQuery.ajax() - JSONP - re-use callbacks name" + label, 2, {
|
ajaxTest( "#8205 - jQuery.ajax() - JSONP - re-use callbacks name" + label, 2, {
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "42"
|
content: "42"
|
||||||
},
|
},
|
||||||
@ -1318,7 +1321,7 @@ module( "ajax", {
|
|||||||
test( "#11743 - jQuery.ajax() - script, throws exception", 1, function() {
|
test( "#11743 - jQuery.ajax() - script, throws exception", 1, function() {
|
||||||
raises(function() {
|
raises(function() {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "SYNTAX ERROR"
|
content: "SYNTAX ERROR"
|
||||||
},
|
},
|
||||||
@ -1342,7 +1345,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
function request( option ) {
|
function request( option ) {
|
||||||
var options = {
|
var options = {
|
||||||
url: service("echo/"),
|
url: service("echo/index.php"),
|
||||||
data: {
|
data: {
|
||||||
requestArray: "POST",
|
requestArray: "POST",
|
||||||
content: "hello"
|
content: "hello"
|
||||||
@ -1398,7 +1401,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
asyncTest( "jQuery.ajaxSetup()", 1, function() {
|
asyncTest( "jQuery.ajaxSetup()", 1, function() {
|
||||||
jQuery.ajaxSetup({
|
jQuery.ajaxSetup({
|
||||||
url: service("echo/"),
|
url: service("echo"),
|
||||||
data: {
|
data: {
|
||||||
content: "bar"
|
content: "bar"
|
||||||
},
|
},
|
||||||
@ -1417,7 +1420,7 @@ module( "ajax", {
|
|||||||
timeout: 50
|
timeout: 50
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
url: service("echo/?delay=1"),
|
url: service("echo?delay=1"),
|
||||||
error: function( _, status ) {
|
error: function( _, status ) {
|
||||||
strictEqual( status, "timeout", "timed out" );
|
strictEqual( status, "timeout", "timed out" );
|
||||||
}
|
}
|
||||||
@ -1431,7 +1434,7 @@ module( "ajax", {
|
|||||||
},
|
},
|
||||||
type: "GET",
|
type: "GET",
|
||||||
timeout: 15000,
|
timeout: 15000,
|
||||||
url: service("echo/?delay=1"),
|
url: service("echo?delay=1"),
|
||||||
success: function() {
|
success: function() {
|
||||||
ok( true, "Check for local timeout" );
|
ok( true, "Check for local timeout" );
|
||||||
}
|
}
|
||||||
@ -1448,14 +1451,14 @@ module( "ajax", {
|
|||||||
ok( false, "Global event triggered" );
|
ok( false, "Global event triggered" );
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery("#qunit-fixture").append("<script src='" + service( "echo/", {
|
jQuery("#qunit-fixture").append("<script src='" + service( "echo", {
|
||||||
requestArray: "GET",
|
requestArray: "GET",
|
||||||
content: "ok( true, \"script executed\" );"
|
content: "ok( true, \"script executed\" );"
|
||||||
}) + "'></script>");
|
}) + "'></script>");
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() {
|
asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() {
|
||||||
jQuery("#qunit-fixture").load( service( "echo/", {
|
jQuery("#qunit-fixture").load( service( "echo", {
|
||||||
content:
|
content:
|
||||||
"<script>\n<!--\nok( true, \"script within html comments executed\" );\n-->\n</script>\n" +
|
"<script>\n<!--\nok( true, \"script within html comments executed\" );\n-->\n</script>\n" +
|
||||||
"<script>\n<![CDATA[\nok( true, \"script within CDATA executed\" );\n]]>\n</script>"
|
"<script>\n<![CDATA[\nok( true, \"script within CDATA executed\" );\n]]>\n</script>"
|
||||||
@ -1466,7 +1469,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
asyncTest( "jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes", 2, function() {
|
asyncTest( "jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes", 2, function() {
|
||||||
var tabs = [ "blabla", "blublu" ];
|
var tabs = [ "blabla", "blublu" ];
|
||||||
jQuery.get( service( "echo/", {
|
jQuery.get( service( "echo", {
|
||||||
contentType: "text/xml",
|
contentType: "text/xml",
|
||||||
content: createDashboardXML( true )
|
content: createDashboardXML( true )
|
||||||
}), function( xml ) {
|
}), function( xml ) {
|
||||||
@ -1483,7 +1486,7 @@ module( "ajax", {
|
|||||||
content: "helloworld"
|
content: "helloworld"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery.get( service("echo/"), function( data ) {
|
jQuery.get( service("echo"), function( data ) {
|
||||||
strictEqual( data, "helloworld", "Data from ajaxSettings was used" );
|
strictEqual( data, "helloworld", "Data from ajaxSettings was used" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
@ -1493,7 +1496,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
asyncTest( "jQuery.getJSON( String, Hash, Function ) - JSON array", 1, function() {
|
asyncTest( "jQuery.getJSON( String, Hash, Function ) - JSON array", 1, function() {
|
||||||
jQuery.getJSON(
|
jQuery.getJSON(
|
||||||
service("echo/"),
|
service("echo"),
|
||||||
{
|
{
|
||||||
"content": "[{ \"name\": \"John\", \"age\": 21 }, { \"name\": \"Peter\", \"age\": 25 }]"
|
"content": "[{ \"name\": \"John\", \"age\": 21 }, { \"name\": \"Peter\", \"age\": 25 }]"
|
||||||
},
|
},
|
||||||
@ -1511,7 +1514,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "jQuery.getJSON( String, Function ) - JSON object", 1, function() {
|
asyncTest( "jQuery.getJSON( String, Function ) - JSON object", 1, function() {
|
||||||
jQuery.getJSON( service( "echo/", {
|
jQuery.getJSON( service( "echo", {
|
||||||
content: "{ \"data\": { \"lang\": \"en\", \"length\": 25 } }"
|
content: "{ \"data\": { \"lang\": \"en\", \"length\": 25 } }"
|
||||||
}), function( json ) {
|
}), function( json ) {
|
||||||
deepEqual( json, {
|
deepEqual( json, {
|
||||||
@ -1537,14 +1540,14 @@ module( "ajax", {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jQuery.getJSON( service("echo/"), function( json ) {
|
jQuery.getJSON( service("echo"), function( json ) {
|
||||||
strictEqual( json, true, "Verifying return value" );
|
strictEqual( json, true, "Verifying return value" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "jQuery.getJSON( String, Function ) - JSON object with absolute url to local content", 1, function() {
|
asyncTest( "jQuery.getJSON( String, Function ) - JSON object with absolute url to local content", 1, function() {
|
||||||
jQuery.getJSON( window.location.href.replace( /[^\/]*$/, "" ) + service( "echo/", {
|
jQuery.getJSON( window.location.href.replace( /[^\/]*$/, "" ) + service( "echo", {
|
||||||
content: "{ \"data\": { \"lang\": \"en\", \"length\": 25 } }"
|
content: "{ \"data\": { \"lang\": \"en\", \"length\": 25 } }"
|
||||||
}), function( json ) {
|
}), function( json ) {
|
||||||
deepEqual( json, {
|
deepEqual( json, {
|
||||||
@ -1561,7 +1564,7 @@ module( "ajax", {
|
|||||||
|
|
||||||
asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() {
|
asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() {
|
||||||
Globals.register("testBar");
|
Globals.register("testBar");
|
||||||
jQuery.getScript( service("echo/", {
|
jQuery.getScript( service("echo", {
|
||||||
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
||||||
}), function( data, _, jqXHR ) {
|
}), function( data, _, jqXHR ) {
|
||||||
strictEqual( testBar, "bar", "Check if script was evaluated" );
|
strictEqual( testBar, "bar", "Check if script was evaluated" );
|
||||||
@ -1571,14 +1574,14 @@ module( "ajax", {
|
|||||||
|
|
||||||
asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() {
|
asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() {
|
||||||
Globals.register("testBar");
|
Globals.register("testBar");
|
||||||
jQuery.getScript( service("echo/", {
|
jQuery.getScript( service("echo", {
|
||||||
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
||||||
}) ).done( start );
|
}) ).done( start );
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() {
|
asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() {
|
||||||
Globals.register("testBar");
|
Globals.register("testBar");
|
||||||
jQuery.getScript( service("echo/", {
|
jQuery.getScript( service("echo", {
|
||||||
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
|
||||||
}), function( data, _, jqXHR ) {
|
}), function( data, _, jqXHR ) {
|
||||||
strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" );
|
strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" );
|
||||||
@ -1595,7 +1598,7 @@ module( "ajax", {
|
|||||||
strictEqual( this.type, "GET", "no data means GET request" );
|
strictEqual( this.type, "GET", "no data means GET request" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery("#first").load( service( "echo/", {
|
jQuery("#first").load( service( "echo", {
|
||||||
content: "<script>ok( true, \"html injected\" )</script>"
|
content: "<script>ok( true, \"html injected\" )</script>"
|
||||||
}), start );
|
}), start );
|
||||||
});
|
});
|
||||||
@ -1615,7 +1618,7 @@ module( "ajax", {
|
|||||||
strictEqual( this.type, "GET", "null data means GET request" );
|
strictEqual( this.type, "GET", "null data means GET request" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery("#first").load( service( "echo/", {
|
jQuery("#first").load( service( "echo", {
|
||||||
content: "<script>ok( true, \"html injected\" )</script>"
|
content: "<script>ok( true, \"html injected\" )</script>"
|
||||||
}), null, start );
|
}), null, start );
|
||||||
});
|
});
|
||||||
@ -1627,14 +1630,14 @@ module( "ajax", {
|
|||||||
strictEqual( this.type, "GET", "undefined data means GET request" );
|
strictEqual( this.type, "GET", "undefined data means GET request" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery("#first").load( service( "echo/", {
|
jQuery("#first").load( service( "echo", {
|
||||||
content: "<script>ok( true, \"html injected\" )</script>"
|
content: "<script>ok( true, \"html injected\" )</script>"
|
||||||
}), undefined, start );
|
}), undefined, start );
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if load can be called with only url
|
// check if load can be called with only url
|
||||||
asyncTest( "jQuery.fn.load( URL_SELECTOR )", 1, function() {
|
asyncTest( "jQuery.fn.load( URL_SELECTOR )", 1, function() {
|
||||||
jQuery("#first").load( service("echo/", {
|
jQuery("#first").load( service("echo", {
|
||||||
content: "<div class=\"user\"></div><div class=\"user\"></div><div></div>"
|
content: "<div class=\"user\"></div><div class=\"user\"></div><div></div>"
|
||||||
}) + " div.user", function() {
|
}) + " div.user", function() {
|
||||||
strictEqual( jQuery( this ).children("div").length, 2, "Verify that specific elements were injected" );
|
strictEqual( jQuery( this ).children("div").length, 2, "Verify that specific elements were injected" );
|
||||||
@ -1643,7 +1646,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "jQuery.fn.load( String, Function ) - simple: inject text into DOM", 2, function() {
|
asyncTest( "jQuery.fn.load( String, Function ) - simple: inject text into DOM", 2, function() {
|
||||||
jQuery("#first").load( service( "echo/", {
|
jQuery("#first").load( service( "echo", {
|
||||||
content: "INJECTED<script>ok( true, \"html injected\" )</script>"
|
content: "INJECTED<script>ok( true, \"html injected\" )</script>"
|
||||||
}), function() {
|
}), function() {
|
||||||
ok( /^INJECTED/.test(jQuery("#first").text()), "Check if content was injected into the DOM" );
|
ok( /^INJECTED/.test(jQuery("#first").text()), "Check if content was injected into the DOM" );
|
||||||
@ -1661,7 +1664,7 @@ module( "ajax", {
|
|||||||
Globals.register("testFoo");
|
Globals.register("testFoo");
|
||||||
Globals.register("testBar");
|
Globals.register("testBar");
|
||||||
|
|
||||||
jQuery("#first").load( service( "echo/", {
|
jQuery("#first").load( service( "echo", {
|
||||||
content: createComplexHTML()
|
content: createComplexHTML()
|
||||||
}), function() {
|
}), function() {
|
||||||
ok( jQuery("#first").html().match( /^html text/ ), "Check content after loading html" );
|
ok( jQuery("#first").html().match( /^html text/ ), "Check content after loading html" );
|
||||||
@ -1672,7 +1675,7 @@ module( "ajax", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "jQuery.fn.load( String, Function ) - check file with only a script tag", 3, function() {
|
asyncTest( "jQuery.fn.load( String, Function ) - check file with only a script tag", 3, function() {
|
||||||
jQuery("#first").load( service("echo/", {
|
jQuery("#first").load( service("echo", {
|
||||||
content: "<script>var testFoo = \"foo\"; jQuery(\"#foo\").html(\"foo\"); ok( true, \"script executed\" );</script>"
|
content: "<script>var testFoo = \"foo\"; jQuery(\"#foo\").html(\"foo\"); ok( true, \"script executed\" );</script>"
|
||||||
}), function() {
|
}), function() {
|
||||||
strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM");
|
strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM");
|
||||||
@ -1687,7 +1690,7 @@ module( "ajax", {
|
|||||||
return "Hello World";
|
return "Hello World";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery("<div/>").load( service("echo/"), function( responseText ) {
|
jQuery("<div/>").load( service("echo"), function( responseText ) {
|
||||||
strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" );
|
strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" );
|
||||||
strictEqual( responseText, "Hello World", "Test callback receives filtered data" );
|
strictEqual( responseText, "Hello World", "Test callback receives filtered data" );
|
||||||
start();
|
start();
|
||||||
@ -1732,7 +1735,7 @@ module( "ajax", {
|
|||||||
jQuery.map([
|
jQuery.map([
|
||||||
{
|
{
|
||||||
type: "success",
|
type: "success",
|
||||||
url: service("echo/")
|
url: service("echo")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "error",
|
type: "error",
|
||||||
@ -1762,7 +1765,7 @@ module( "ajax", {
|
|||||||
strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
|
strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
jQuery("#first").load( service("echo/") );
|
jQuery("#first").load( service("echo") );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in", 1, function() {
|
test( "#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in", 1, function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user