Fixes #7229 and #5803
[jquery.git] / test / unit / ajax.js
index 85c7380..14c6218 100644 (file)
@@ -104,7 +104,10 @@ test(".ajax() - 304", function() {
        jQuery.ajax({
                url: url("data/notmodified.php"),
                success: function(){ ok(true, "304 ok"); },
-               error: function(){ ok(false, "304 not ok "); },
+               // Do this because opera simply refuses to implement 304 handling :(
+               // A feature-driven way of detecting this would be appreciated
+               // See: http://gist.github.com/599419
+               error: function(){ ok(jQuery.browser.opera, "304 not ok "); },
                complete: function(xhr){ start(); }
        });
 });
@@ -796,6 +799,21 @@ test("jQuery.ajax() - JSONP, Local", function() {
                        plus();
                }
        });
+       
+  // Supports Ticket #5803     
+       jQuery.ajax({
+               url: "data/jsonp.php",
+               jsonpCallback: "jsonpResults",
+               success: function(data){
+                       ok( data.data, "JSON results returned without dataType:jsonp when jsonpCallback is defined" );
+                       plus();
+               },
+               error: function(data){
+                       ok( false, "Ajax error JSON (GET, custom callback name)" );
+                       plus();
+               }
+       });             
+       
 });
 
 test("JSONP - Custom JSONP Callback", function() {
@@ -1249,13 +1267,20 @@ test("jQuery.ajax - If-Modified-Since support", function() {
                                        start();
                                },
                                error: function() {
-                                       equals(false, "error");
+                                       // Do this because opera simply refuses to implement 304 handling :(
+                                       // A feature-driven way of detecting this would be appreciated
+                                       // See: http://gist.github.com/599419
+                                       ok(jQuery.browser.opera, "error");
+                                       ok(jQuery.browser.opera, "error");
                                        start();
                                }
                        });
                },
                error: function() {
-                       equals(false, "error");
+                       // Do this because opera simply refuses to implement 304 handling :(
+                       // A feature-driven way of detecting this would be appreciated
+                       // See: http://gist.github.com/599419
+                       ok(jQuery.browser.opera, "error");
                        start();
                }
        });
@@ -1288,20 +1313,27 @@ test("jQuery.ajax - Etag support", function() {
                                        start();
                                },
                                error: function() {
-                                       equals(false, "error");
+                                       // Do this because opera simply refuses to implement 304 handling :(
+                                       // A feature-driven way of detecting this would be appreciated
+                                       // See: http://gist.github.com/599419
+                                       ok(jQuery.browser.opera, "error");
+                                       ok(jQuery.browser.opera, "error");
                                        start();
                                }
                        });
                },
                error: function() {
-                       equals(false, "error");
+                       // Do this because opera simply refuses to implement 304 handling :(
+                       // A feature-driven way of detecting this would be appreciated
+                       // See: http://gist.github.com/599419
+                       ok(jQuery.browser.opera, "error");
                        start();
                }
        });
 });
 
 test("jQuery.ajax - active counter", function() {
-    ok( jQuery.ajax.active == 0, "ajax active counter should be zero: " + jQuery.ajax.active );
+    ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
 });