From cf041e18f46d95de44ae61dac4785fea68a6a21b Mon Sep 17 00:00:00 2001 From: Thomas Buckley-Houston Date: Wed, 11 May 2022 12:01:35 -0300 Subject: Allow indentation to be repeated --- spec/novim_mode_spec.rb | 25 +++++++++++++++++++++++++ spec/spec_helper.rb | 10 ++++++++++ 2 files changed, 35 insertions(+) (limited to 'spec') diff --git a/spec/novim_mode_spec.rb b/spec/novim_mode_spec.rb index c784772..d513d13 100644 --- a/spec/novim_mode_spec.rb +++ b/spec/novim_mode_spec.rb @@ -111,6 +111,31 @@ describe 'Selecting' do EOF end + specify 'ALT+] indents' do + initial <<-EOF + a line of text + EOF + + type '' + type '' + type '' + + final_with_indents "\t\ta line of text\n" + end + + specify 'Shift-Tab or ALT+[ indents' do + initial <<-EOF + a line of text + EOF + + type '' + type '' + type '' + type '' + + final_with_indents "\ta line of text\n" + end + specify 'CTRL+D selects the word under the cursor' do initial <<-EOF a line of text diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cfe5a51..c09f394 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -40,6 +40,11 @@ def load_file_content IO.read(@file).strip end +def load_file_content_unstripped + vim.write + IO.read(@file) +end + def type(string) string.scan(/<.*?>|./).each do |key| if key =~ /<.*>/ @@ -60,6 +65,11 @@ def final(string) expect(load_file_content).to eq expected end +def final_with_indents(string) + expected = string + expect(load_file_content_unstripped).to eq expected +end + def use_extension(ext) @ext = ext end -- cgit v1.2.3-70-g09d2