Yet another missing semicolon!
[jquery.git] / test / unit / ajax.js
index d849cff..4162d58 100644 (file)
@@ -276,7 +276,7 @@ test(".ajax() - retry with jQuery.ajax( this )", function() {
                                start();
                        }
                }
-       })
+       });
 
 });
 
@@ -316,6 +316,28 @@ test(".ajax() - headers" , function() {
 
 });
 
+test(".ajax() - Accept header" , function() {
+
+       expect( 1 );
+
+       stop();
+
+       jQuery.ajax(url("data/headers.php?keys=accept"), {
+               headers: {
+                       Accept: "very wrong accept value"
+               },
+               beforeSend: function( xhr ) {
+                       xhr.setRequestHeader( "Accept", "*/*" );
+               },
+               success: function( data ) {
+                       strictEqual( data , "accept: */*\n" , "Test Accept header is set to last value provided" );
+                       start();
+               },
+               error: function(){ ok(false, "error"); }
+       });
+
+});
+
 test(".ajax() - contentType" , function() {
 
        expect( 2 );
@@ -1025,6 +1047,18 @@ test("load(String, Function) - check file with only a script tag", function() {
        });
 });
 
+test("load(String, Function) - dataFilter in ajaxSettings", function() {
+       expect(2);
+       stop();
+       jQuery.ajaxSetup({ dataFilter: function() { return "Hello World"; } });
+       var div = jQuery("<div/>").load(url("data/name.html"), function(responseText) {
+               strictEqual( div.html(), "Hello World" , "Test div was filled with filtered data" );
+               strictEqual( responseText, "Hello World" , "Test callback receives filtered data" );
+               jQuery.ajaxSetup({ dataFilter: 0 });
+               start();
+       });
+});
+
 test("load(String, Object, Function)", function() {
        expect(2);
        stop();
@@ -1081,10 +1115,10 @@ test("jQuery.getScript(String, Function) - no callback", function() {
 });
 
 test("jQuery.ajax() - JSONP, Local", function() {
-       expect(9);
+       expect(10);
 
        var count = 0;
-       function plus(){ if ( ++count == 9 ) start(); }
+       function plus(){ if ( ++count == 10 ) start(); }
 
        stop();
 
@@ -1131,6 +1165,22 @@ test("jQuery.ajax() - JSONP, Local", function() {
        jQuery.ajax({
                url: "data/jsonp.php",
                dataType: "jsonp",
+               data: {
+                       callback: "?"
+               },
+               success: function(data){
+                       ok( data.data, "JSON results returned (GET, processed data callback)" );
+                       plus();
+               },
+               error: function(data){
+                       ok( false, "Ajax error JSON (GET, processed data callback)" );
+                       plus();
+               }
+       });
+
+       jQuery.ajax({
+               url: "data/jsonp.php",
+               dataType: "jsonp",
                jsonp: "callback",
                success: function(data){
                        ok( data.data, "JSON results returned (GET, data obj callback)" );