From 2cd99e64b70cfe940ed4692eb5c6186ba255a7be Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sat, 18 Feb 2017 11:12:55 -0700 Subject: [PATCH] Add a test for modifying widget list vars after sourcing plugin --- spec/options/widget_lists_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/options/widget_lists_spec.rb b/spec/options/widget_lists_spec.rb index eefc057..00441ee 100644 --- a/spec/options/widget_lists_spec.rb +++ b/spec/options/widget_lists_spec.rb @@ -67,3 +67,18 @@ describe 'a zle widget' do end end end + +describe 'a modification to the widget lists' do + let(:widget) { 'my-widget' } + let(:before_sourcing) { -> { session.run_command("#{widget}() {}; zle -N #{widget}; bindkey ^B #{widget}") } } + before { session.run_command("ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{widget})") } + + it 'takes effect on the next cmd line' do + with_history('echo hello') do + session.send_string('e') + wait_for { session.content }.to eq('echo hello') + session.send_keys('C-b') + wait_for { session.content(esc_seqs: true) }.to eq('echo hello') + end + end +end