Commit 1643b888 authored by Juan Corona's avatar Juan Corona

Add a test to cover the case of `Sidebar.destroy()`

Increases coverage, tests calls spawned in annotator/main.js `appLinkEl.addEventListener('destroy`, `window.annotator.destroy();`
parent 078c5003
......@@ -19,6 +19,7 @@ describe 'Sidebar', ->
fakeCrossFrame.onConnect = sandbox.stub().returns(fakeCrossFrame)
fakeCrossFrame.on = sandbox.stub().returns(fakeCrossFrame)
fakeCrossFrame.call = sandbox.spy()
fakeCrossFrame.destroy = sandbox.stub()
CrossFrame = sandbox.stub()
CrossFrame.returns(fakeCrossFrame)
......@@ -184,3 +185,14 @@ describe 'Sidebar', ->
sidebar.show()
sidebar.element.trigger(event)
assert.isFalse(sidebar.isOpen())
describe 'destruction', ->
sidebar = null
beforeEach ->
sidebar = createSidebar({})
it 'the sidebar is destroyed and the frame is detached', ->
sidebar.destroy()
assert.called(fakeCrossFrame.destroy)
assert.equal(sidebar.frame[0].parentElement, null)
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