Sha256: 29faf428033c14e140c5a6f266d53b72de58191bc7786e13299a7f9256e39690

Contents?: true

Size: 1.28 KB

Versions: 12

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe ActiveAdmin::Views::Panel do

  let(:the_panel) do
    render_arbre_component do
      panel "My Title" do
        span("Hello World")
      end
    end
  end

  it "should have a title h3" do
    the_panel.find_by_tag("h3").first.content.should == "My Title"
  end

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

  it "should add children to the contents div" do
    the_panel.find_by_tag("span").first.parent.should == the_panel.find_by_tag("div").first
  end

  it "should set the icon" do
    the_panel = render_arbre_component do
      panel("Title", :icon => :arrow_down)
    end
    the_panel.find_by_tag("h3").first.content.should include("span class=\"icon")
  end

  it "should allow a html_safe title (without icon)" do
    title_with_html = %q[Title with <abbr>HTML</abbr>].html_safe
    the_panel = render_arbre_component do
      panel(title_with_html)
    end
    the_panel.find_by_tag("h3").first.content.should eq(title_with_html)
  end

  describe "#children?" do

    it "returns false if no children have been added to the panel" do
      the_panel = render_arbre_component do
        panel("A Panel")
      end
      the_panel.children?.should == false
    end

  end

end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
activeadmin-0.6.6 spec/unit/views/components/panel_spec.rb
activeadmin-0.6.5 spec/unit/views/components/panel_spec.rb
activeadmin-0.6.4 spec/unit/views/components/panel_spec.rb
yousty-activeadmin-1.0.4.pre spec/unit/views/components/panel_spec.rb
yousty-activeadmin-1.0.3.pre spec/unit/views/components/panel_spec.rb
yousty-activeadmin-1.0.2.pre spec/unit/views/components/panel_spec.rb
activeadmin-0.6.3 spec/unit/views/components/panel_spec.rb
yousty-activeadmin-1.0.1.pre spec/unit/views/components/panel_spec.rb
yousty-activeadmin-1.0.0.pre spec/unit/views/components/panel_spec.rb
activeadmin-0.6.2 spec/unit/views/components/panel_spec.rb
activeadmin-0.6.1 spec/unit/views/components/panel_spec.rb
aa-rails4-0.6.0 spec/unit/views/components/panel_spec.rb