Sha256: 2fb35206e7e7e03ed013f9e98e9e4d3460c1918e14a6129ca28d77cef53a2de7

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe BootstrapIt::ViewHelpers::DropdownMenu do
  it { expect(helper).to render_with 'ul.dropdown-menu[@role="menu"]' }

  it 'reders devider' do
    expect(helper { |h| h.divider }).to render_with(
      'ul > li.divider[@role="presentation"]'
    )
  end

  it 'renders header' do
    expect(helper { |h| h.header 'test' }).to render_with(
      'ul > li.dropdown-header[@role="presentation"]'
    )
  end

  it 'renders link item' do
    expect(helper { |h| h.link_item 'test', 'http://url' }).to render_with(
      'ul > li[@role="presentation"]' \
      ' > a[@href="http://url"][@role="menuitem"][@tabindex="-1"]'
    )
  end

  it 'renders disabled link item' do
    expect(
      helper { |h| h.link_item 'test', :disabled, 'http://url' }
    ).to render_with(
      'ul > li.disabled[@role="presentation"]' \
      ' > a[@href="http://url"][@role="menuitem"][@tabindex="-1"]'
    )
  end

  it 'supports right-align' do
    expect(helper align: :right).to render_with 'ul.dropdown-menu.pull-right'
  end

  # options cleaning
  it { expect(helper align: 'right').to_not have_option :align }
  it { expect(helper align: :none).to_not have_option :align }
end

Version data entries

2 entries across 2 versions & 1 rubygems

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