mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:51:05 +08:00
Convert all Ajax calls to use Discourse.ajax()
This commit is contained in:
@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user