Unverified Commit f6053a1a authored by Hannah Stepanek's avatar Hannah Stepanek Committed by GitHub

Merge pull request #1062 from hypothesis/make-sidebar-open-on-group-link

Open the sidebar when direct-linked group
parents af9dedc4 ea3fefe3
...@@ -34,7 +34,7 @@ module.exports = class Sidebar extends Host ...@@ -34,7 +34,7 @@ module.exports = class Sidebar extends Host
this.hide() this.hide()
if config.openSidebar || config.annotations || config.query if config.openSidebar || config.annotations || config.query || config.group
this.on 'panelReady', => this.show() this.on 'panelReady', => this.show()
if @plugins.BucketBar? if @plugins.BucketBar?
......
...@@ -233,6 +233,58 @@ describe 'Sidebar', -> ...@@ -233,6 +233,58 @@ describe 'Sidebar', ->
sidebar.onPan({type: 'panright', deltaX: 100}) sidebar.onPan({type: 'panright', deltaX: 100})
assert.equal(sidebar.gestureState.final, 0) assert.equal(sidebar.gestureState.final, 0)
describe 'panelReady event', ->
it 'opens the sidebar when a direct-linked annotation is present.', ->
sidebar = createSidebar(
config={
annotations: 'ann-id',
}
)
show = sandbox.stub(sidebar, 'show')
sidebar.publish('panelReady')
assert.calledOnce(show)
it 'opens the sidebar when a direct-linked group is present.', ->
sidebar = createSidebar(
config={
group: 'group-id',
}
)
show = sandbox.stub(sidebar, 'show')
sidebar.publish('panelReady')
assert.calledOnce(show)
it 'opens the sidebar when a direct-linked query is present.', ->
sidebar = createSidebar(
config={
query: 'tag:foo',
}
)
show = sandbox.stub(sidebar, 'show')
sidebar.publish('panelReady')
assert.calledOnce(show)
it 'opens the sidebar when openSidebar is set to true.', ->
sidebar = createSidebar(
config={
openSidebar: true,
}
)
show = sandbox.stub(sidebar, 'show')
sidebar.publish('panelReady')
assert.calledOnce(show)
it 'does not show the sidebar if not configured to.', ->
sidebar = createSidebar(
config={
}
)
show = sandbox.stub(sidebar, 'show')
sidebar.publish('panelReady')
assert.notCalled(show)
describe 'swipe gestures', -> describe 'swipe gestures', ->
sidebar = null sidebar = 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