Sha256: 24c5baca5a7e9d95f60c74fcb32fe35f02c46f90c2e7c443b1b9537efee3f362

Contents?: true

Size: 830 Bytes

Versions: 4

Compression:

Stored size: 830 Bytes

Contents

require 'spec_helper'

describe TP::Slide::Paragraph do
  subject { slide }

  let(:markdown) { "# Paragraph\n\nShort paragraph" }
  let(:slide) { klass.new markdown }

  before do
    Screen.stub width: 20
  end

  its(:width) { should == 15 }
  its(:height) { should == 3 }

  describe "#render" do
    subject(:lines) { slide.render.lines.to_a }

    it { lines.count.should == 3 }

    it "centers the header" do
      lines[0].should == "Paragraph".center(20) + "\n"
    end

    it "centers short paragraphs" do
      lines[2].should == "Short paragraph".center(20)
    end

    context "with long paragraphs" do
      let(:markdown) { "# Paragraph\n\nThis is a very long paragraph" }

      it "wraps" do
        lines[2].should == "This is a very long\n"
        lines[3].should == "paragraph"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tp-0.5.1 spec/lib/tp/slide/paragraph_spec.rb
tp-0.5.0 spec/lib/tp/slide/paragraph_spec.rb
tp-0.4.1 spec/lib/tp/slide/paragraph_spec.rb
tp-0.4.0 spec/lib/tp/slide/paragraph_spec.rb