Commit 3ea20092 authored by Juan Corona's avatar Juan Corona

Move ‘setAllVisibleHighlights’ method and add a test for it

It makes more sense that this method is implemented in the Sidebar instead of Host
parent 849947d3
......@@ -64,9 +64,3 @@ module.exports = class Host extends Guest
destroy: ->
@frame.remove()
super
setAllVisibleHighlights: (shouldShowHighlights) ->
@crossframe.call('setVisibleHighlights', shouldShowHighlights)
# Let the Toolbar know about this event
this.publish 'setVisibleHighlights', shouldShowHighlights
......@@ -190,3 +190,9 @@ module.exports = class Sidebar extends Host
isOpen: ->
!@frame.hasClass('annotator-collapsed')
setAllVisibleHighlights: (shouldShowHighlights) ->
@crossframe.call('setVisibleHighlights', shouldShowHighlights)
# Let the Toolbar know about this event
this.publish 'setVisibleHighlights', shouldShowHighlights
......@@ -243,3 +243,13 @@ describe 'Sidebar', ->
sidebar.hide()
assert.isFalse sidebar.visibleHighlights
describe '#setAllVisibleHighlights', ->
it 'sets the state through crossframe and emits', ->
sidebar = createSidebar({})
sandbox.stub(sidebar, 'publish')
sidebar.setAllVisibleHighlights(true)
assert.calledWith(fakeCrossFrame.call, 'setVisibleHighlights', true)
assert.calledWith(sidebar.publish, 'setVisibleHighlights', true)
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