Sha256: 4fff375bcc56b5efdc4890688044fce74adbbdbf946b2d33e39de372865a9d73

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Slacken::Filters::ElimLineBreaks, dsl: true do
  describe '#valid?' do
    subject { described_class.new.valid?(component) }

    context 'when no linebreaks occur' do
      let(:component) do
        c(:div, c(:h1, text('yo!')), c(:wrapper, text('hello world!'), text('another')))
      end

      it { is_expected.to be_truthy }
    end

    context 'when a linebreak occurs in a inline component' do
      let(:component) do
        c(:div, c(:h1, text('yo!')), c(:wrapper, text('hello world!'), text("another\n")))
      end

      it { is_expected.to be_falsey }
    end

    context 'when a linebreak occurs in a block component' do
      let(:component) do
        c(:div, c(:h1, text("yo\n!")), c(:wrapper, text('hello world!'), text("another")))
      end

      it { is_expected.to be_falsey }
    end

    context 'when a linebreak occurs in a pre tag' do
      let(:component) do
        c(:div, c(:pre, text("yo\n!")), c(:wrapper, text('hello world!'), text("another")))
      end

      it { is_expected.to be_truthy }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slacken-0.1.6 spec/slacken/filters/elim_line_breaks_spec.rb
slacken-0.1.5 spec/slacken/filters/elim_line_breaks_spec.rb
slacken-0.1.4 spec/slacken/filters/elim_line_breaks_spec.rb
slacken-0.1.3 spec/slacken/filters/elim_line_breaks_spec.rb
slacken-0.1.2 spec/slacken/filters/elim_line_breaks_spec.rb
slacken-0.1.1 spec/slacken/filters/elim_line_breaks_spec.rb