Sha256: 9118941a03df6806436763dcc8953823cb27152fced734c45eda70c67e2820b3

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe BootstrapIt::ViewHelpers::ListItem do
  it { expect(helper).to render_with 'li' }
  it { expect(helper).to be_kind_of BootstrapIt::ViewHelpers::Disableable }
  it { expect(helper).to be_kind_of WrapIt::TextContainer }
end

describe BootstrapIt::ViewHelpers::ListLinkItem do
  it { expect(helper).to be_kind_of WrapIt::Link }

  it { expect(helper).to render_with 'li > a' }

  it 'passes `li` or `li_options` as options to li' do
    %i(li li_options).each do |key|
      @helper = nil
      expect(helper(key => {class: 'list'})).to render_with 'li.list > a'
    end
  end

  it 'passes `li_*` options to li' do
    expect(helper(li_class: 'list')).to render_with 'li.list > a'
  end

  it 'passes `li_*` arguments to li' do
    expect(helper(:li_active)).to render_with 'li.active > a'
  end

  it 'passes `active` and `disable` arguments to li' do
    %i(active disabled disable).each do |key|
      @helper = nil
      html_class = key == :disable ? :disabled : key
      expect(helper(key)).to render_with "li.#{html_class} > a"
    end
  end

  it 'passes `active` and `disable` options to li' do
    %i(active disabled disable).each do |key|
      @helper = nil
      html_class = key == :disable ? :disabled : key
      expect(helper(key => true)).to render_with "li.#{html_class} > a"
    end
  end

  it 'keeps not related to list optioins and arguments' do
    expect(
      helper('text', 'url', li_class: 'list', class: 'link')
    ).to render_with 'li.list > a.link[@href="url"][text()="text"]'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_it-0.1.1 spec/view_helpers/list_spec.rb
bootstrap_it-0.1.0 spec/view_helpers/list_spec.rb