X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=10c2e71837837dd6d6efaf201fca33c1ab8b8cdc;hb=97b244312e5dba9b28129006c9407ca80bb6c99b;hp=c7803f857acb5bf6c40448683b4a1fcac0ec385a;hpb=6504d4f7005c99ea4064068f3d712322a064b97a;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index c7803f8..10c2e71 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -276,7 +276,7 @@ test(".ajax() - retry with jQuery.ajax( this )", function() { start(); } } - }) + }); }); @@ -1115,10 +1115,10 @@ test("jQuery.getScript(String, Function) - no callback", function() { }); test("jQuery.ajax() - JSONP, Local", function() { - expect(10); + expect(14); var count = 0; - function plus(){ if ( ++count == 10 ) start(); } + function plus(){ if ( ++count == 14 ) start(); } stop(); @@ -1163,6 +1163,59 @@ test("jQuery.ajax() - JSONP, Local", function() { }); jQuery.ajax({ + url: "data/jsonp.php?callback=??", + dataType: "jsonp", + success: function(data){ + ok( data.data, "JSON results returned (GET, url context-free callback)" ); + plus(); + }, + error: function(data){ + ok( false, "Ajax error JSON (GET, url context-free callback)" ); + plus(); + } + }); + + jQuery.ajax({ + url: "data/jsonp.php", + dataType: "jsonp", + data: "callback=??", + success: function(data){ + ok( data.data, "JSON results returned (GET, data context-free callback)" ); + plus(); + }, + error: function(data){ + ok( false, "Ajax error JSON (GET, data context-free callback)" ); + plus(); + } + }); + + jQuery.ajax({ + url: "data/jsonp.php/??", + dataType: "jsonp", + success: function(data){ + ok( data.data, "JSON results returned (GET, REST-like)" ); + plus(); + }, + error: function(data){ + ok( false, "Ajax error JSON (GET, REST-like)" ); + plus(); + } + }); + + jQuery.ajax({ + url: "data/jsonp.php/???json=1", + dataType: "jsonp", + success: function(data){ + strictEqual( jQuery.type(data), "array", "JSON results returned (GET, REST-like with param)" ); + plus(); + }, + error: function(data){ + ok( false, "Ajax error JSON (GET, REST-like with param)" ); + plus(); + } + }); + + jQuery.ajax({ url: "data/jsonp.php", dataType: "jsonp", data: {