Convert all Ajax calls to use Discourse.ajax()

This commit is contained in:
Robin Ward
2013-04-01 16:28:26 -04:00
parent 5344ab2893
commit 61b5c0340e
42 changed files with 243 additions and 247 deletions

View File

@ -5,20 +5,20 @@ describe("Discourse.Onebox", function() {
var anchor;
beforeEach(function() {
spyOn(jQuery, 'ajax').andCallThrough();
spyOn(Discourse, 'ajax').andCallThrough();
anchor = $("<a href='http://bla.com'></a>")[0];
});
it("Stops rapid calls with cache true", function() {
Discourse.Onebox.load(anchor, true);
Discourse.Onebox.load(anchor, true);
expect($.ajax.calls.length).toBe(1);
expect(Discourse.ajax.calls.length).toBe(1);
});
it("Stops rapid calls with cache false", function() {
Discourse.Onebox.load(anchor, false);
Discourse.Onebox.load(anchor, false);
expect($.ajax.calls.length).toBe(1);
expect(Discourse.ajax.calls.length).toBe(1);
});
});