ajaxTest( "jQuery.ajax() - GET", 1, {
type: "GET",
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "bar"
},
ajaxTest( "jQuery.ajax() - success", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
- url: service("echo"),
+ url: service("echo/"),
beforeSend: function() {
ok( true, "beforeSend" );
},
ajaxTest( "jQuery.ajax() - success - (url, options)", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
create: function( options ) {
- return jQuery.ajax( service("echo"), options );
+ return jQuery.ajax( service("echo/"), options );
},
beforeSend: function() {
ok( true, "beforeSend" );
ajaxTest( "jQuery.ajax() - success - late binding", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
- url: service("echo"),
+ url: service("echo/"),
beforeSend: function() {
ok( true, "beforeSend" );
},
ajaxTest( "jQuery.ajax() - success - oncomplete binding", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
- url: service("echo"),
+ url: service("echo/"),
beforeSend: function() {
ok( true, "beforeSend" );
},
ajaxTest( "jQuery.ajax() - error", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"),
- url: service("error"),
+ url: service("error/"),
beforeSend: function() {
ok( true, "beforeSend" );
},
ajaxTest( "jQuery.ajax() - abort - textStatus and errorThrown values", 4, [
{
- url: service("echo"),
+ url: service("echo/"),
data: {
delay: 1
},
}
},
{
- url: service("echo"),
+ url: service("echo/"),
data: {
delay: 1
},
]);
ajaxTest( "jQuery.ajax() - error - responseText", 1, {
- url: service("echo"),
+ url: service("echo/"),
data: {
status: 400,
content: "plain text message"
var previousUrl,
firstTime = true;
jQuery.ajax({
- url: service("error"),
+ url: service("error/"),
error: function() {
if ( firstTime ) {
firstTime = false;
} else {
ok ( true, "Test retrying with jQuery.ajax(this) works" );
jQuery.ajax({
- url: service("error"),
+ url: service("error/"),
data: {
"x": 1
},
xhr.setRequestHeader( "ajax-send", "test" );
});
},
- url: service("headers/request"),
+ url: service("headers/request/"),
data: {
headers: "siMPle,SometHing-elsE,OthEr,ajax-send"
},
xhr.setRequestHeader( "ajax-send", "test" );
});
},
- url: service("headers/response"),
+ url: service("headers/response/"),
data: {
"Sample-Header": "sample value",
"Sample-Header2": "sample value 2",
});
ajaxTest( "jQuery.ajax() - headers - Accept", 1, {
- url: service("headers/request"),
+ url: service("headers/request/"),
data: {
headers: "accept"
},
ajaxTest( "jQuery.ajax() - headers - contentType option", 2, [
{
- url: service("headers/request"),
+ url: service("headers/request/"),
data: {
headers: "content-type"
},
}
},
{
- url: service("headers/request"),
+ url: service("headers/request/"),
data: {
headers: "content-type"
},
ajaxTest( "jQuery.ajax() - abort", 9, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"),
- url: service("echo"),
+ url: service("echo/"),
data: {
delay: 1
},
}, 0 );
},
requests: [{
- url: service("echo"),
+ url: service("echo/"),
beforeSend: callback("beforeSend"),
success: callback("success"),
complete: callback("complete")
}, {
- url: service("error"),
+ url: service("error/"),
beforeSend: callback("beforeSend"),
error: callback("error"),
complete: callback("complete")
};
}
return {
- url: service("error"),
+ url: service("error/"),
beforeSend: nocallback("beforeSend"),
error: nocallback("error"),
complete: nocallback("complete")
});
ajaxTest( "jQuery.ajax() - context - modification", 1, {
- url: service("error"),
+ url: service("error/"),
context: {},
beforeSend: function() {
this.test = "foo";
strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." );
},
requests: [{
- url: service("error"),
+ url: service("error/"),
error: function() {
strictEqual( this, obj, "Make sure the original object is maintained." );
}
}, {
- url: service("error"),
+ url: service("error/"),
context: {},
error: function() {
ok( this !== obj, "Make sure overidding context is possible." );
ajaxTest( "jQuery.ajax() - events - disable", 3, {
setup: addGlobalEvents(""),
global: false,
- url: service("echo"),
+ url: service("echo/"),
beforeSend: function() {
ok( true, "beforeSend" );
},
});
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements", 3, {
- url: service("echo"),
+ url: service("echo/"),
data: {
contentType: "text/xml",
content: createWithFriesXML( true )
});
ajaxTest( "jQuery.ajax() - xml - non-namespace elements inside namespaced elements (over JSONP)", 3, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: createWithFriesXML( true )
},
});
ajaxTest( "jQuery.ajax() - atom+xml", 2, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "<root><element /></root>",
contentType: "atom+xml"
});
ajaxTest( "jQuery.ajax() - beforeSend", 1, {
- url: service("error"),
+ url: service("error/"),
beforeSend: function( xml ) {
this.check = true;
},
ajaxTest( "jQuery.ajax() - beforeSend, cancel request manually", 2, {
create: function() {
return jQuery.ajax({
- url: service("error"),
+ url: service("error/"),
beforeSend: function( xhr ) {
ok( true, "beforeSend got called, canceling" );
xhr.abort();
Globals.register("testBar");
},
dataType: "html",
- url: service("echo"),
+ url: service("echo/"),
data: {
content: createComplexHTML()
},
});
ajaxTest( "jQuery.ajax() - synchronous request", 1, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "hello world"
},
});
ajaxTest( "jQuery.ajax() - synchronous request - callbacks", 2, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "hello world"
},
start();
});
- ok( jQuery.get( service("echo"), success ), "get" );
- ok( jQuery.post( service("echo"), success ), "post" );
- ok( jQuery.getScript( service("echo"), success ), "script" );
- ok( jQuery.getJSON( service("echo?content=0"), success ), "json" );
+ ok( jQuery.get( service("echo/"), success ), "get" );
+ ok( jQuery.post( service("echo/"), success ), "post" );
+ ok( jQuery.getScript( service("echo/"), success ), "script" );
+ ok( jQuery.getJSON( service("echo/?content=0"), success ), "json" );
ok( jQuery.ajax({
- url: service("echo"),
+ url: service("echo/"),
success: success
}), "generic" );
});
strictEqual( data, "041275", "JSON results returned - " + this.type + " - " + options.title );
}
}, options );
- tmp.url = service( "echo" + ( options.url || "" ) );
+ tmp.url = service( "echo/" + ( options.url || "" ) );
return tmp;
}
}),
request({
title: "REST-like",
- url: "/index.php/??"
+ url: "index.php/??"
}),
request({
title: "REST-like (with param)",
- url: "/index.php/???content=\"041275\"",
+ url: "index.php/???content=\"041275\"",
beforeSend: function() {
delete this.data;
}
ajaxTest( "jQuery.ajax() - JSONP - POST" + label, 3, [
request({
title: "no callback",
- type: "POST",
- url: "/"
+ type: "POST"
}),
request({
title: "data callback",
type: "POST",
- url: "/",
data: "content=041275&callback=?"
}),
request({
title: "data obj callback",
type: "POST",
- url: "/",
jsonp: "callback"
})
]);
});
ajaxTest( "jQuery.ajax() - malformed JSON", 2, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "{bad: toTheBone}"
},
return 42;
}
},
- url: service("headers/response/index.php"),
+ url: service("headers/response/"),
data: {
"Content-Type": "application/json"
},
ok( false, "content-type detected" );
}
},
- url: service("headers/response/index.php"),
+ url: service("headers/response/"),
data: {
"Content-Type": "application/json"
},
});
ajaxTest( "jQuery.ajax() - JSON - empty", 1, {
- url: service("echo"),
+ url: service("echo/"),
dataType: "json",
error: function( _, __, error ) {
strictEqual( typeof error, "object", "error object for empty json response" );
ajaxTest( "jQuery.ajax() - statusText", 4, [
{
- url: service("echo"),
+ url: service("echo/"),
data: {
status: 200,
statusText: "Hello"
}
},
{
- url: service("echo"),
+ url: service("echo/"),
data: {
status: 404,
statusText: "Hello"
}
]);
- jQuery.each( [ "error", service("echo") ], function( isSuccess, url ) {
+ jQuery.each( [ service("error/"), service("echo/") ], function( isSuccess, url ) {
function statusCodes( title ) {
return {
200: function() {
dataType = srcType + " " + dataType;
}
return {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "\"041275\""
},
ajaxTest( "jQuery.ajax() - overrideMimeType", 2, [
{
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "42"
},
}
},
{
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "42"
},
});
ajaxTest( "#2806 - jQuery.ajax() - data option - evaluate function values", 1, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: function() {
return "value";
},
{
create: function() {
- return jQuery.ajax( service("echo") );
+ return jQuery.ajax( service("echo/") );
},
done: function() {
ok( true, "With only string URL argument" );
},
{
create: function() {
- return jQuery.ajax( service("echo"), {});
+ return jQuery.ajax( service("echo/"), {});
},
done: function() {
ok( true, "With string URL param and map" );
create: function( options ) {
return jQuery.ajax( options );
},
- url: service("echo"),
+ url: service("echo/"),
success: function() {
ok( true, "With only map" );
}
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
ajaxTest( "#8205 - jQuery.ajax() - JSONP - re-use callbacks name" + label, 2, {
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "42"
},
test( "#11743 - jQuery.ajax() - script, throws exception", 1, function() {
raises(function() {
jQuery.ajax({
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "SYNTAX ERROR"
},
function request( option ) {
var options = {
- url: service("echo/index.php"),
+ url: service("echo/"),
data: {
requestArray: "POST",
content: "hello"
asyncTest( "jQuery.ajaxSetup()", 1, function() {
jQuery.ajaxSetup({
- url: service("echo"),
+ url: service("echo/"),
data: {
content: "bar"
},
timeout: 50
});
},
- url: service("echo?delay=1"),
+ url: service("echo/?delay=1"),
error: function( _, status ) {
strictEqual( status, "timeout", "timed out" );
}
},
type: "GET",
timeout: 15000,
- url: service("echo?delay=1"),
+ url: service("echo/?delay=1"),
success: function() {
ok( true, "Check for local timeout" );
}
ok( false, "Global event triggered" );
});
- jQuery("#qunit-fixture").append("<script src='" + service( "echo", {
+ jQuery("#qunit-fixture").append("<script src='" + service( "echo/", {
requestArray: "GET",
content: "ok( true, \"script executed\" );"
}) + "'></script>");
});
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:
"<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>"
asyncTest( "jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes", 2, function() {
var tabs = [ "blabla", "blublu" ];
- jQuery.get( service( "echo", {
+ jQuery.get( service( "echo/", {
contentType: "text/xml",
content: createDashboardXML( true )
}), function( xml ) {
content: "helloworld"
}
});
- jQuery.get( service("echo"), function( data ) {
+ jQuery.get( service("echo/"), function( data ) {
strictEqual( data, "helloworld", "Data from ajaxSettings was used" );
start();
});
asyncTest( "jQuery.getJSON( String, Hash, Function ) - JSON array", 1, function() {
jQuery.getJSON(
- service("echo"),
+ service("echo/"),
{
"content": "[{ \"name\": \"John\", \"age\": 21 }, { \"name\": \"Peter\", \"age\": 25 }]"
},
});
asyncTest( "jQuery.getJSON( String, Function ) - JSON object", 1, function() {
- jQuery.getJSON( service( "echo", {
+ jQuery.getJSON( service( "echo/", {
content: "{ \"data\": { \"lang\": \"en\", \"length\": 25 } }"
}), function( json ) {
deepEqual( json, {
return true;
}
};
- jQuery.getJSON( service("echo"), function( json ) {
+ jQuery.getJSON( service("echo/"), function( json ) {
strictEqual( json, true, "Verifying return value" );
start();
});
});
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 } }"
}), function( json ) {
deepEqual( json, {
asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() {
Globals.register("testBar");
- jQuery.getScript( service("echo", {
+ jQuery.getScript( service("echo/", {
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
}), function( data, _, jqXHR ) {
strictEqual( testBar, "bar", "Check if script was evaluated" );
asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() {
Globals.register("testBar");
- jQuery.getScript( service("echo", {
+ jQuery.getScript( service("echo/", {
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
}) ).done( start );
});
asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() {
Globals.register("testBar");
- jQuery.getScript( service("echo", {
+ jQuery.getScript( service("echo/", {
content: "var testBar = \"bar\"; ok( true, \"script executed\");"
}), function( data, _, jqXHR ) {
strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" );
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>"
}), start );
});
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>"
}), null, start );
});
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>"
}), undefined, start );
});
// check if load can be called with only url
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>"
}) + " div.user", function() {
strictEqual( jQuery( this ).children("div").length, 2, "Verify that specific elements were injected" );
});
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>"
}), function() {
ok( /^INJECTED/.test(jQuery("#first").text()), "Check if content was injected into the DOM" );
Globals.register("testFoo");
Globals.register("testBar");
- jQuery("#first").load( service( "echo", {
+ jQuery("#first").load( service( "echo/", {
content: createComplexHTML()
}), function() {
ok( jQuery("#first").html().match( /^html text/ ), "Check content after loading html" );
});
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>"
}), function() {
strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM");
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( responseText, "Hello World", "Test callback receives filtered data" );
start();
jQuery.map([
{
type: "success",
- url: service("echo")
+ url: service("echo/")
},
{
type: "error",
strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
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() {