Commit b23e16ed authored by Aron Carroll's avatar Aron Carroll

Stub out the tests for CrossFrameDiscovery

parent c34b965a
assert = chai.assert
sinon.assert.expose assert, prefix: null
describe 'CrossFrameDiscovery', ->
sandbox = sinon.sandbox.create()
fakeWindow = null
createDiscovery = null
beforeEach module('h')
beforeEach inject (CrossFrameDiscovery) ->
fakeWindow = {
top: null
addEventListener: sandbox.stub()
removeEventListener: sandbox.stub()
}
createBridge = (options) ->
new CrossFrameDiscovery(fakeWindow, options)
afterEach ->
sandbox.restore()
describe 'startDiscovery', ->
it 'adds a "message" listener to the window object'
describe 'when acting as a server (options.server = true)', ->
it 'sends out a "discovery" message to every frame'
it 'does not send the message to itself'
it 'sends an "ack" on receiving a "request"'
it 'calls the discovery callback on receiving "request"'
describe 'when acting as a client (options.client = false)', ->
it 'sends out a discovery message to every frame'
it 'does not send the message to itself'
it 'sends a "request" in response to an "offer"'
it 'does not respond to an "offer" if a "request" is already in progress'
it 'allows responding to a "request" once a previous "request" has completed'
it 'calls the discovery callback on receiving an "ack"'
describe 'stopDiscovery', ->
it 'removes the "message" listener from the window'
it 'allows startDiscovery to be called with a new handler'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment