unittests/tests/dataloader.js
branchpopcorn-port
changeset 452 35495f156c41
parent 291 e942a49240f4
equal deleted inserted replaced
451:2217bd6fd068 452:35495f156c41
    39     
    39     
    40     var resp2 = dt.get("/url&a=2", spy_callback);
    40     var resp2 = dt.get("/url&a=2", spy_callback);
    41     ok(spy_callback.calledTwice && xhr.requests.length === 1, "callback called twice but request made only once.");
    41     ok(spy_callback.calledTwice && xhr.requests.length === 1, "callback called twice but request made only once.");
    42     
    42     
    43   });
    43   });
       
    44  
       
    45   test("should default to JSONP for foreign domains", function() {
       
    46     /* we can't simulate jsonp so we just verify that the function is called */
       
    47     var stub = this.stub(IriSP.jQuery, "ajax");
       
    48     var dt = new IriSP.DataLoader();
    44     
    49     
       
    50     var resp = dt.get("http://example.com/url&a=1", stub);
       
    51 
       
    52     ok(stub.calledOnce, "ajax request actually made");
       
    53   });
       
    54    
    45 }
    55 }