Sha256: a95fd9703f6a49657f805bc2d077459623d1a39a000bcdd02a6f0a6b171618c3

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 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 'returns false when there is no text' do
      expect(subject.text?).to be_falsey
    end
    it 'returns 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 'proxies 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 'is 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 'does not have any alignment if there is no text' do
      expect(subject.content_align).to be_nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-spotlight-0.19.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.18.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.17.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.17.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.16.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.15.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.14.2 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.14.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb