Sha256: 3092778640b58cfa8599b7b772e4eeb62f05590bc92880f29fc8c012d9abf266

Contents?: true

Size: 1.25 KB

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
blacklight-spotlight-0.14.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.13.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.12.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.12.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.11.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.10.3 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.10.2 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.10.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.10.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.9.2 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.9.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.9.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.8.2 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.8.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.8.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.7.2 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.7.1 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.7.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.6.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb
blacklight-spotlight-0.5.0 spec/models/sir_trevor_rails/blocks/textable_spec.rb