comparison .zfun/zsh-autosuggestions/spec/integrations/wrapped_widget_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 'a wrapped widget' do
2 let(:widget) { 'backward-delete-char' }
3
4 context 'initialized before sourcing the plugin' do
5 let(:before_sourcing) do
6 -> do
7 session.
8 run_command("_orig_#{widget}() { zle .#{widget} }").
9 run_command("zle -N orig-#{widget} _orig_#{widget}").
10 run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
11 run_command("zle -N #{widget} #{widget}-magic")
12 end
13 end
14
15 it 'executes the custom behavior and the built-in behavior' do
16 with_history('foobar', 'foodar') do
17 session.send_string('food').send_keys('C-h')
18 wait_for { session.content }.to eq('foobar')
19 end
20 end
21 end
22
23 context 'initialized after sourcing the plugin' do
24 before do
25 session.
26 run_command("zle -N orig-#{widget} ${widgets[#{widget}]#*:}").
27 run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
28 run_command("zle -N #{widget} #{widget}-magic").
29 clear_screen
30 end
31
32 it 'executes the custom behavior and the built-in behavior' do
33 with_history('foobar', 'foodar') do
34 session.send_string('food').send_keys('C-h')
35 wait_for { session.content }.to eq('foobar')
36 end
37 end
38 end
39 end