Sha256: f92e78c6ae3ccc7031543839b178f8146828ec8092000db96b99a555a0205190

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

class Slacken::DocumentComponent
  describe ElimLineBreaks, dsl: true do
    describe '#has_no_line_breaks?' do
      subject { component.has_no_line_breaks? }

      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slacken-0.1.0 spec/slacken/document_component/elim_line_breaks_spec.rb