Sha256: 66de2f4ac894be9bf679e8e075761c74fdf8be2bd024e30f24da2a5df0cf6dfc

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require "spec_helper"

describe SirTrevorRails::Blocks::Textable do
  class TextableTestClass
    include SirTrevorRails::Blocks::Textable
    attr_accessor :text
  end
  let(:subject) { TextableTestClass.new }
  let(:st_blank_text) { '<p><br></p>' }
  describe '#text?' do
    it 'should return false when there is no text' do
      expect(subject.text?).to be_falsey
    end
    it 'should return true false when the text is the default sir-trevor text' do
      allow(subject).to receive_messages(text: st_blank_text)
      expect(subject.text?).to be_truthy
    end
  end
  describe '#text_align' do
    it 'should proxy the sir-trevor text-align attribute' do
      allow(subject).to receive_messages(:'text-align' => 'text-align-value')
      expect(subject.text_align).to eq 'text-align-value'
    end
  end
  describe '#content_align' do
    it 'should be the reverse of text-align' do
      allow(subject).to receive_messages(text: 'TextContent')
      allow(subject).to receive_messages(text_align: 'left')
      expect(subject.content_align).to eq 'right'
      allow(subject).to receive_messages(text_align: 'right')
      expect(subject.content_align).to eq 'left'
    end
    it 'should not have any alignment if there is no text' do
      expect(subject.content_align).to be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/models/spotlight/sir_trevor_blocks/textable_spec.rb