require 'spec_helper'
module RevealCK
module Markdown
describe PostProcessor do
it 'unprotects emojis' do
input = ':moneyEUwithEUwings:'
output = PostProcessor.new(input).process
expect(output).to include ':money_with_wings:'
input = ':blueEUheart:'
output = PostProcessor.new(input).process
expect(output).to include ':blue_heart:'
input = ':non-potableEUwater:'
output = PostProcessor.new(input).process
expect(output).to include ':non-potable_water:'
end
context 'handling notes' do
let :transformed_notes do
<<-EOS.strip_heredoc
DIVIDER
NOTES_OPEN
This is a note
NOTES_CLOSE
DIVIDER
EOS
end
it 'translates
NOTES_OPEN
into \n"
end
end
context 'without vertical slides' do
let :three_slide_input do
<<-EOS.strip_heredoc
DIVIDER
First
DIVIDER
Second
DIVIDER
Third
DIVIDER
EOS
end
let :three_slides_output do
<<-EOS.strip_heredoc
First
Second
Third
EOS
end
it 'starts the output with a and a newline' do
output = PostProcessor.new(three_slide_input).process
expect(output).to start_with "\n"
end
it 'ends the output with a newline, a , and a newline' do
output = PostProcessor.new(three_slide_input).process
expect(output).to end_with "\n\n"
end
it 'replaces intermediate
DIVIDER
s with section breaks' do
output = PostProcessor.new(three_slide_input).process
expect(output).to eq three_slides_output
end
end
context 'with vertical slides' do
context 'single vertical slide' do
let :single_vertical_input do
<<-EOS.strip_heredoc
VERTICAL_START
First
DIVIDER
Second
DIVIDER
Third
VERTICAL_END
EOS
end
let :single_vertical_output do
<<-EOS.strip_heredoc
First
Second
Third
EOS
end
it 'starts the output with two s' do
output = PostProcessor.new(single_vertical_input).process
expect(output).to start_with "\n"
end
it 'ends the output a newline, two s, and a newline' do
output = PostProcessor.new(single_vertical_input).process
expect(output).to end_with "\n\n\n"
end
it 'separates the "internal" slides correctly' do
output = PostProcessor.new(single_vertical_input).process
expect(output).to eq single_vertical_output
end
end
context 'back-to-back vertical slides' do
let :double_vertical_input do
<<-EOS.strip_heredoc
VERTICAL_START
Vertical A1
DIVIDER
Vertical A2
DIVIDER
Vertical A3
VERTICAL_END
VERTICAL_START
Vertical B1
DIVIDER
Vertical B2
DIVIDER
Vertical B3
VERTICAL_END
EOS
end
let :double_vertical_output do
<<-EOS.strip_heredoc
Vertical A1
Vertical A2
Vertical A3
Vertical B1
Vertical B2
Vertical B3
EOS
end
it 'creates two columns of sections' do
output = PostProcessor.new(double_vertical_input).process
expect(output).to eq double_vertical_output
end
end
context 'horizontal and vertical combinations' do
let :verticals_surrounded_by_horizontals_input do
<<-EOS.strip_heredoc
DIVIDER
First
VERTICAL_START
Vertical A1
DIVIDER
Vertical A2
DIVIDER
Vertical A3
VERTICAL_END
Middle
VERTICAL_START
Vertical B1
DIVIDER
Vertical B2
DIVIDER
Vertical B3
VERTICAL_END
Last
DIVIDER
EOS
end
let :verticals_surrounded_by_horizontals_output do
<<-EOS.strip_heredoc
First
Vertical A1
Vertical A2
Vertical A3
Middle
Vertical B1
Vertical B2
Vertical B3
Last
EOS
end
it 'creates a slide, a column, a slide, a column, and a slide' do
processor =
PostProcessor.new(verticals_surrounded_by_horizontals_input)
output = processor.process
expect(output).to eq verticals_surrounded_by_horizontals_output
end
end
end
end
end
end