Sha256: f8f50bc52c4999e99d9d1a8a26161a3397dfebfb33e63347fb4a0c7188571f24

Contents?: true

Size: 886 Bytes

Versions: 17

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe Locomotive::EditableElement do

  let(:attributes)  { {} }
  let(:element)     { described_class.new(attributes) }

  describe '#label' do

    subject { element.label }

    let(:attributes) { { slug: 'first_column', label: 'Column #1' } }

    it { is_expected.to eq 'Column #1' }

    describe 'if not defined, use the slug' do

      let(:attributes) { { slug: 'first_column' } }

      it { is_expected.to eq 'First column' }

    end

  end

  describe '#path' do

    subject { element.path }

    it { is_expected.to eq '' }

    context 'no block and a slug' do

      let(:attributes) { { slug: 'banner' } }
      it { is_expected.to eq 'banner' }

    end

    context 'a block and a slug' do

      let(:attributes) { { block: 'content/header', slug: 'banner' } }
      it { is_expected.to eq 'content--header--banner' }

    end

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms-3.3.0 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.3.0.rc3 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.3.0.rc2 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.2 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.2.1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.3.0.rc1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.2.0 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.2.0.rc2 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.2.0.rc1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.0 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.0.rc3 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.0.rc2 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.1.0.rc1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.0.1 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.0.0 spec/models/locomotive/editable_element_spec.rb
locomotivecms-3.0.0.rc7 spec/models/locomotive/editable_element_spec.rb