-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from dkarter/minor-changes-to-alphabetic-bullets
Minor changes to alphabetic bullets
- Loading branch information
Showing
4 changed files
with
175 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe 'Bullets.vim' do | ||
describe 'alphabetic bullets' do | ||
it 'adds a new upper case bullet' do | ||
filename = "#{SecureRandom.hex(6)}.txt" | ||
write_file(filename, <<-TEXT) | ||
# Hello there | ||
A. this is the first bullet | ||
TEXT | ||
|
||
vim.edit filename | ||
vim.type 'GA' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'second bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'third bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'fourth bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'fifth bullet' | ||
vim.write | ||
|
||
file_contents = IO.read(filename) | ||
|
||
expect(file_contents).to eq normalize_string_indent(<<-TEXT) | ||
# Hello there | ||
A. this is the first bullet | ||
B. second bullet | ||
C. third bullet | ||
D. fourth bullet | ||
E. fifth bullet\n | ||
TEXT | ||
end | ||
|
||
it 'adds a new lower case bullet' do | ||
filename = "#{SecureRandom.hex(6)}.txt" | ||
write_file(filename, <<-TEXT) | ||
# Hello there | ||
a. this is the first bullet | ||
TEXT | ||
|
||
vim.edit filename | ||
vim.type 'GA' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'second bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'third bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'fourth bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'fifth bullet' | ||
vim.write | ||
|
||
file_contents = IO.read(filename) | ||
|
||
expect(file_contents).to eq normalize_string_indent(<<-TEXT) | ||
# Hello there | ||
a. this is the first bullet | ||
b. second bullet | ||
c. third bullet | ||
d. fourth bullet | ||
e. fifth bullet\n | ||
TEXT | ||
end | ||
|
||
it 'adds a new bullet and loops at z' do | ||
filename = "#{SecureRandom.hex(6)}.txt" | ||
write_file(filename, <<-TEXT) | ||
# Hello there | ||
y. this is the first bullet | ||
TEXT | ||
|
||
vim.edit filename | ||
vim.type 'GA' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'second bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'third bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'AY. fourth bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'fifth bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'sixth bullet' | ||
vim.write | ||
|
||
file_contents = IO.read(filename) | ||
|
||
expect(file_contents).to eq normalize_string_indent(<<-TEXT) | ||
# Hello there | ||
y. this is the first bullet | ||
z. second bullet | ||
aa. third bullet | ||
AY. fourth bullet | ||
AZ. fifth bullet | ||
BA. sixth bullet\n | ||
TEXT | ||
end | ||
|
||
describe 'g:bullets_max_alpha_characters' do | ||
it 'stops adding items after configured max (default 2)' do | ||
filename = "#{SecureRandom.hex(6)}.txt" | ||
write_file(filename, <<-TEXT) | ||
# Hello there | ||
zy. this is the first bullet | ||
TEXT | ||
|
||
vim.edit filename | ||
vim.type 'GA' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'second bullet' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'not a bullet' | ||
vim.write | ||
|
||
file_contents = IO.read(filename) | ||
|
||
expect(file_contents).to eq normalize_string_indent(<<-TEXT) | ||
# Hello there | ||
zy. this is the first bullet | ||
zz. second bullet | ||
not a bullet\n | ||
TEXT | ||
end | ||
|
||
it 'does not bullets if configured as 0' do | ||
filename = "#{SecureRandom.hex(6)}.txt" | ||
write_file(filename, <<-TEXT) | ||
# Hello there | ||
a. this is the first bullet | ||
TEXT | ||
|
||
vim.command 'let g:bullets_max_alpha_characters = 0' | ||
vim.edit filename | ||
vim.type 'GA' | ||
vim.feedkeys '\<cr>' | ||
vim.type 'not a bullet' | ||
vim.write | ||
|
||
file_contents = IO.read(filename) | ||
|
||
expect(file_contents).to eq normalize_string_indent(<<-TEXT) | ||
# Hello there | ||
a. this is the first bullet | ||
not a bullet\n | ||
TEXT | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters