comparison .zfun/zsh-autosuggestions/spec/widgets/enable_spec.rb @ 467:e1ce8897030d

zsh: import df6f6f9ff41 of zsh-autosuggestions
author Augie Fackler <raf@durin42.com>
date Mon, 03 Dec 2018 22:37:29 -0500
parents
children
comparison
equal deleted inserted replaced
466:f248cf012d9a 467:e1ce8897030d
1 describe 'the `autosuggest-enable` widget' do
2 before do
3 session.
4 run_command('typeset -g _ZSH_AUTOSUGGEST_DISABLED').
5 run_command('bindkey ^B autosuggest-enable')
6 end
7
8 it 'enables suggestions and fetches a suggestion' do
9 with_history('echo hello') do
10 session.send_string('e')
11 sleep 1
12 expect(session.content).to eq('e')
13
14 session.send_keys('C-b')
15 session.send_string('c')
16 wait_for { session.content }.to eq('echo hello')
17 end
18 end
19
20 context 'invoked on an empty buffer' do
21 it 'does not fetch a suggestion' do
22 with_history('echo hello') do
23 session.send_keys('C-b')
24 sleep 1
25 expect(session.content).to eq('')
26 end
27 end
28 end
29
30 context 'invoked on a non-empty buffer' do
31 it 'fetches a suggestion' do
32 with_history('echo hello') do
33 session.send_string('e')
34 sleep 1
35 expect(session.content).to eq('e')
36
37 session.send_keys('C-b')
38 wait_for { session.content }.to eq('echo hello')
39 end
40 end
41 end
42 end