Skip to content

Commit

Permalink
add some alphabetic list tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaymmm committed Feb 23, 2020
1 parent 44e9753 commit 8b8c1a2
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions spec/bullets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,129 @@
TEXT
end

it 'adds a new alphabetical list 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 alphabetical list 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 alphabetical list 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

it 'stops adding more alphabetical items after g:bullets_max_alpha_characters (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 'deletes the last bullet if it is empty' do
filename = "#{SecureRandom.hex(6)}.txt"
write_file(filename, <<-TEXT)
Expand Down

0 comments on commit 8b8c1a2

Please sign in to comment.