Skip to content

Commit

Permalink
Add keyboard controls for minimap position
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Feb 12, 2015
1 parent 5e0548c commit a741d92
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/minimap-quick-settings-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ class MinimapQuickSettingsElement extends HTMLElement
@subscriptions.add Main.onDidDeactivatePlugin ({name, plugin}) =>
@deactivateItem(name, plugin)

@subscriptions.add atom.commands.add '.minimap-quick-settings',
@subscriptions.add atom.commands.add 'minimap-quick-settings',
'core:move-up': => @selectPreviousItem()
'core:move-down': => @selectNextItem()
'core:move-left': => atom.config.set('minimap.displayMinimapOnLeft', true)
'core:move-right': => atom.config.set('minimap.displayMinimapOnLeft', false)
'core:cancel': => @destroy()
'core:confirm': => @toggleSelectedItem()

Expand Down
23 changes: 23 additions & 0 deletions spec/minimap-element-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,29 @@ describe 'MinimapElement', ->
expect(quickSettingsElement.querySelector('.btn.selected:last-child')).not.toExist()
expect(quickSettingsElement.querySelector('.btn.selected:first-child')).toExist()

describe 'core:move-left', ->
beforeEach ->
atom.commands.dispatch quickSettingsElement, 'core:move-left'

it 'toggles the displayMinimapOnLeft setting', ->
expect(atom.config.get('minimap.displayMinimapOnLeft')).toBeTruthy()

it 'changes the buttons activation state', ->
expect(quickSettingsElement.querySelector('.btn.selected:last-child')).not.toExist()
expect(quickSettingsElement.querySelector('.btn.selected:first-child')).toExist()

describe 'core:move-right when the minimap is on the right', ->
beforeEach ->
atom.config.set('minimap.displayMinimapOnLeft', true)
atom.commands.dispatch quickSettingsElement, 'core:move-right'

it 'toggles the displayMinimapOnLeft setting', ->
expect(atom.config.get('minimap.displayMinimapOnLeft')).toBeFalsy()

it 'changes the buttons activation state', ->
expect(quickSettingsElement.querySelector('.btn.selected:first-child')).not.toExist()
expect(quickSettingsElement.querySelector('.btn.selected:last-child')).toExist()


describe 'clicking on the open settings button again', ->
beforeEach ->
Expand Down

0 comments on commit a741d92

Please sign in to comment.