X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=35f87a8881b487d5b86ece24bba199ca05b07d2d;hb=e1af5faf80ff9a457bcb78757c3eb04b55e931d1;hp=813c65fbc09dc28b7929299b3da2e23f9bd262ff;hpb=12ef255ffdb3c2d045ee37beb9419f14d9c30217;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 813c65f..35f87a8 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -372,6 +372,7 @@ test("$.get(String, Hash, Function) - parse xml and use text() on nodes", functi test("$.getScript(String, Function) - with callback", function() { expect(2); stop(); + window.foobar = null; $.getScript(url("data/test.js"), function() { equals( foobar, "bar", 'Check if script was evaluated' ); setTimeout(start, 100); @@ -563,6 +564,46 @@ test("$.ajax() - script, Remote", function() { stop(); + window.foobar = null; + $.ajax({ + url: base + "data/test.js", + dataType: "script", + success: function(data){ + ok( foobar, "Script results returned (GET, no callback)" ); + start(); + } + }); +}); + +test("$.ajax() - script, Remote with POST", function() { + expect(3); + + var base = window.location.href.replace(/\?.*$/, ""); + + stop(); + + window.foobar = null; + $.ajax({ + url: base + "data/test.js", + 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)" ); + start(); + } + }); +}); + +test("$.ajax() - script, Remote with scheme-less URL", function() { + expect(2); + + var base = window.location.href.replace(/\?.*$/, ""); + base = base.replace(/^.*?\/\//, "//"); + + stop(); + + window.foobar = null; $.ajax({ url: base + "data/test.js", dataType: "script",