2013-06-19 04:27:40 +08:00
|
|
|
module("Discourse.Onebox", {
|
|
|
|
setup: function() {
|
|
|
|
this.anchor = $("<a href='http://bla.com'></a>")[0];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-07-16 07:47:13 +08:00
|
|
|
asyncTestDiscourse("Stops rapid calls with cache true", function() {
|
|
|
|
this.stub(Discourse, "ajax").returns(Ember.RSVP.resolve());
|
2013-06-19 04:27:40 +08:00
|
|
|
Discourse.Onebox.load(this.anchor, true);
|
|
|
|
Discourse.Onebox.load(this.anchor, true);
|
2013-07-16 07:47:13 +08:00
|
|
|
|
|
|
|
start();
|
2013-06-19 04:27:40 +08:00
|
|
|
ok(Discourse.ajax.calledOnce);
|
|
|
|
});
|
|
|
|
|
2013-07-16 07:47:13 +08:00
|
|
|
asyncTestDiscourse("Stops rapid calls with cache true", function() {
|
|
|
|
this.stub(Discourse, "ajax").returns(Ember.RSVP.resolve());
|
2013-06-19 04:27:40 +08:00
|
|
|
Discourse.Onebox.load(this.anchor, false);
|
|
|
|
Discourse.Onebox.load(this.anchor, false);
|
2013-07-16 07:47:13 +08:00
|
|
|
|
|
|
|
start();
|
2013-06-19 04:27:40 +08:00
|
|
|
ok(Discourse.ajax.calledOnce);
|
2013-07-16 07:47:13 +08:00
|
|
|
});
|