mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
stop onebox rapid fire
This commit is contained in:
14
spec/javascripts/onebox.js.coffee
Normal file
14
spec/javascripts/onebox.js.coffee
Normal file
@ -0,0 +1,14 @@
|
||||
describe "Discourse.Onebox", ->
|
||||
|
||||
beforeEach ->
|
||||
spyOn($, 'ajax').andCallThrough()
|
||||
|
||||
it "Stops rapid calls with cache true", ->
|
||||
Discourse.Onebox.lookup('http://bla.com', true, (c) -> c)
|
||||
Discourse.Onebox.lookup('http://bla.com', true, (c) -> c)
|
||||
expect($.ajax.calls.length).toBe(1)
|
||||
|
||||
it "Stops rapid calls with cache false", ->
|
||||
Discourse.Onebox.lookup('http://bla.com/a', false, (c) -> c)
|
||||
Discourse.Onebox.lookup('http://bla.com/a', false, (c) -> c)
|
||||
expect($.ajax.calls.length).toBe(1)
|
Reference in New Issue
Block a user