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 'without vertical slides' do let :three_slide_input do <<-eos
DIVIDER

First

DIVIDER

Second

DIVIDER

Third

DIVIDER
eos end let :three_slides_output do <<-eos

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
VERTICAL_START
First
DIVIDER
Second
DIVIDER
Third
VERTICAL_END
eos end let :single_vertical_output do <<-eos
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
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
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
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
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