Switched to using new Function instead of eval for handling JSON parsing (Fixes bug...
[jquery.git] / test / unit / ajax.js
index a049fec..fbff2d8 100644 (file)
@@ -642,8 +642,12 @@ test("jQuery.ajax() - script, Remote with POST", function() {
                type: "POST",
                dataType: "script",
                success: function(data, status){
-                       ok( foobar, "Script results returned (GET, no callback)" );
-                       equals( status, "success", "Script results returned (GET, no callback)" );
+                       ok( foobar, "Script results returned (POST, no callback)" );
+                       equals( status, "success", "Script results returned (POST, no callback)" );
+                       start();
+               },
+               error: function(xhr) {
+                       ok( false, "ajax error, status code: " + xhr.status );
                        start();
                }
        });
@@ -689,6 +693,25 @@ test("jQuery.getJSON(String, Function) - JSON object", function() {
        });
 });
 
+test("jQuery.getJSON - Using Native JSON", function() {
+       expect(2);
+       
+       var old = window.JSON;
+       JSON = {
+               parse: function(str){
+                       ok( true, "Verifying that parse method was run" );
+                       return true;
+               }
+       };
+
+       stop();
+       jQuery.getJSON(url("data/json.php"), function(json) {
+               window.JSON = old;
+         equals( json, true, "Verifying return value" );
+         start();
+       });
+});
+
 test("jQuery.getJSON(String, Function) - JSON object with absolute url to local content", function() {
        expect(2);