Skip to content

Commit

Permalink
navigate down
Browse files Browse the repository at this point in the history
  • Loading branch information
hiattp committed Feb 15, 2015
1 parent 1cd3492 commit 2c105fa
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/navigation/global_navigation.rb
Expand Up @@ -19,5 +19,23 @@ def initialize
end
end

class DownArrow < AppleScriptBuilder
def initialize
super
@action << <<-APPLESCRIPT.align_left
set _dictateApp to (name of current application)
on srhandler(vars)
set spokenArguments to (varSpokenArguments of vars)
repeat spokenInteger(spokenArguments) times
tell application "System Events"
key code 125
end tell
end repeat
end srhandler
APPLESCRIPT
include_spoken_integer
end
end

end
end
18 changes: 18 additions & 0 deletions spec/lib/navigation/global_navigation_spec.rb
Expand Up @@ -17,4 +17,22 @@
end
it_behaves_like 'it includes spokenInteger'
end
describe Navigation::Global::DownArrow do
before { @builder = Navigation::Global::DownArrow.new }
it_behaves_like 'an applescript'
it 'triggers the down arrow key a set number of times' do
expect(@builder.action.align_left).to include <<-APPLESCRIPT.align_left
set _dictateApp to (name of current application)
on srhandler(vars)
set spokenArguments to (varSpokenArguments of vars)
repeat spokenInteger(spokenArguments) times
tell application "System Events"
key code 125
end tell
end repeat
end srhandler
APPLESCRIPT
end
it_behaves_like 'it includes spokenInteger'
end
end
3 changes: 3 additions & 0 deletions templates/navigation.yml
Expand Up @@ -34,6 +34,9 @@ Rise /!SpokenArguments!/:
Up /!SpokenArguments!/:
description: Navigate upward the spoken number of times
builds: [[Global, 0, 'Navigation::Global::UpArrow']]
Down /!SpokenArguments!/:
description: Navigate downward the spoken number of times
builds: [[Global, 0, 'Navigation::Global::DownArrow']]
Fuzz /!SpokenArguments!/:
description: Search with Ctrl-p for the spoken phrase
builds: [[org.vim.MacVim, 7, 'Navigation::Vim::CtrlP']]

0 comments on commit 2c105fa

Please sign in to comment.