unittests/tests/dataloader.js
branchpopcorn-port
changeset 452 35495f156c41
parent 291 e942a49240f4
--- a/unittests/tests/dataloader.js	Tue Dec 13 10:27:23 2011 +0100
+++ b/unittests/tests/dataloader.js	Tue Dec 13 15:14:15 2011 +0100
@@ -41,5 +41,15 @@
     ok(spy_callback.calledTwice && xhr.requests.length === 1, "callback called twice but request made only once.");
     
   });
+ 
+  test("should default to JSONP for foreign domains", function() {
+    /* we can't simulate jsonp so we just verify that the function is called */
+    var stub = this.stub(IriSP.jQuery, "ajax");
+    var dt = new IriSP.DataLoader();
     
-}
\ No newline at end of file
+    var resp = dt.get("http://example.com/url&a=1", stub);
+
+    ok(stub.calledOnce, "ajax request actually made");
+  });
+   
+}