2018-11-23 18:18:15 +01:00
|
|
|
describe 'the `completion` suggestion strategy' do
|
|
|
|
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=completion'] }
|
|
|
|
let(:before_sourcing) do
|
|
|
|
-> do
|
|
|
|
session.
|
|
|
|
run_command('autoload compinit && compinit').
|
2019-04-18 07:27:26 +02:00
|
|
|
run_command('_foo() { compadd bar; compadd bat }').
|
2018-11-23 18:18:15 +01:00
|
|
|
run_command('compdef _foo baz')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'suggests the first completion result' do
|
|
|
|
session.send_string('baz ')
|
|
|
|
wait_for { session.content }.to eq('baz bar')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when async mode is enabled' do
|
|
|
|
let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] }
|
|
|
|
|
|
|
|
it 'suggests the first completion result' do
|
|
|
|
session.send_string('baz ')
|
|
|
|
wait_for { session.content }.to eq('baz bar')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|