aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorDavid Serduke <davidserduke@gmail.com>2007-12-12 20:54:44 +0000
committerDavid Serduke <davidserduke@gmail.com>2007-12-12 20:54:44 +0000
commite1af5faf80ff9a457bcb78757c3eb04b55e931d1 (patch)
treeb14e9cf10b266b79b87829391b6cc666ff55b2e8 /test/unit/ajax.js
parent58c640fb1ce09a03399a3a441716cca23f3f2d04 (diff)
downloadjquery-e1af5faf80ff9a457bcb78757c3eb04b55e931d1.tar.gz
jquery-e1af5faf80ff9a457bcb78757c3eb04b55e931d1.zip
Fixed #1750 by adding a url that starts with "//" and is a dataType "script" will now use a cross domain load the same as urls that start with "http".
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 40ec96415..35f87a888 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,7 @@ test("$.ajax() - script, Remote", function() {
stop();
+ window.foobar = null;
$.ajax({
url: base + "data/test.js",
dataType: "script",
@@ -580,6 +582,7 @@ test("$.ajax() - script, Remote with POST", function() {
stop();
+ window.foobar = null;
$.ajax({
url: base + "data/test.js",
type: "POST",
@@ -592,6 +595,25 @@ test("$.ajax() - script, Remote with POST", function() {
});
});
+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",
+ success: function(data){
+ ok( foobar, "Script results returned (GET, no callback)" );
+ start();
+ }
+ });
+});
+
test("$.getJSON(String, Hash, Function) - JSON array", function() {
expect(4);
stop();