2013-02-21 02:15:50 +08:00
|
|
|
/*global waitsFor:true expect:true describe:true beforeEach:true it:true spyOn:true */
|
2013-02-28 10:26:20 +08:00
|
|
|
|
|
|
|
describe("Discourse.Onebox", function() {
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
spyOn(jQuery, 'ajax').andCallThrough();
|
2013-02-21 02:15:50 +08:00
|
|
|
});
|
|
|
|
|
2013-02-28 10:26:20 +08:00
|
|
|
it("Stops rapid calls with cache true", function() {
|
|
|
|
Discourse.Onebox.lookup('http://bla.com', true, function(c) { return c; });
|
|
|
|
Discourse.Onebox.lookup('http://bla.com', true, function(c) { return c; });
|
|
|
|
expect(jQuery.ajax.calls.length).toBe(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Stops rapid calls with cache false", function() {
|
|
|
|
Discourse.Onebox.lookup('http://bla.com/a', false, function(c) { return c; });
|
|
|
|
Discourse.Onebox.lookup('http://bla.com/a', false, function(c) { return c; });
|
|
|
|
expect(jQuery.ajax.calls.length).toBe(1);
|
|
|
|
});
|
2013-02-23 04:41:12 +08:00
|
|
|
|
2013-02-28 10:26:20 +08:00
|
|
|
});
|