mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
20 lines
No EOL
597 B
JavaScript
20 lines
No EOL
597 B
JavaScript
module("Discourse.Onebox", {
|
|
setup: function() {
|
|
this.anchor = $("<a href='http://bla.com'></a>")[0];
|
|
}
|
|
});
|
|
|
|
test("Stops rapid calls with cache true", function() {
|
|
this.stub(Discourse, "ajax").returns(resolvingPromise);
|
|
|
|
Discourse.Onebox.load(this.anchor, true);
|
|
Discourse.Onebox.load(this.anchor, true);
|
|
ok(Discourse.ajax.calledOnce);
|
|
});
|
|
|
|
test("Stops rapid calls with cache false", function() {
|
|
this.stub(Discourse, "ajax").returns(resolvingPromise);
|
|
Discourse.Onebox.load(this.anchor, false);
|
|
Discourse.Onebox.load(this.anchor, false);
|
|
ok(Discourse.ajax.calledOnce);
|
|
}); |