Sha256: f1e2257d05258b5c72eb5a0c8bcdc83780c57c10b4ba06173647b510c5c2325c

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

require 'rails_helper'

describe ActiveAdmin::Views::SidebarSection do

  let(:options) { {} }

  let(:section) do
    ActiveAdmin::SidebarSection.new("Help Section", options) do
      span "Help Me"
    end
  end

  let(:html) do
    render_arbre_component section: section do
      sidebar_section(assigns[:section])
    end
  end

  it "should have a title h3" do
    expect(html.find_by_tag("h3").first.content).to eq "Help Section"
  end

  it "should have the class of 'sidebar_section'" do
    expect(html.class_list).to include("sidebar_section")
  end

  it "should have an id based on the title" do
    expect(html.id).to eq "help-section_sidebar_section"
  end

  it "should have a contents div" do
    expect(html.find_by_tag("div").first.class_list).to include("panel_contents")
  end

  it "should add children to the contents div" do
    expect(html.find_by_tag("span").first.parent).to eq html.find_by_tag("div").first
  end

  context 'with a custom class attribute' do
    let(:options) { { class: 'custom_class' } }

    it "should have 'custom_class' class" do
      expect(html.class_list).to include("custom_class")
    end
  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
yousty-activeadmin-1.0.17.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.16.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.15.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.14.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.13.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.12.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/views/components/sidebar_section_spec.rb
activeadmin-1.0.0.pre1 spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.7.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.6.pre spec/unit/views/components/sidebar_section_spec.rb
yousty-activeadmin-1.0.5.pre spec/unit/views/components/sidebar_section_spec.rb