Sha256: 21ee6ec8f518ed78ffc594b051929dd214c7880c69282f02b3b8032908122ce4

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 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
    expect(the_panel.find_by_tag("h3").first.content).to eq "My Title"
  end

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

  it "should add children to the contents div" do
    expect(the_panel.find_by_tag("span").first.parent).to eq 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
    expect(the_panel.find_by_tag("h3").first.content).to 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
    expect(the_panel.find_by_tag("h3").first.content).to 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
      expect(the_panel.children?).to eq false
    end

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_administration-0.0.3 spec/unit/views/components/panel_spec.rb
activeadministration-0.0.2 spec/unit/views/components/panel_spec.rb
active_administration-0.0.2 spec/unit/views/components/panel_spec.rb
activeadministration-0.0.1 spec/unit/views/components/panel_spec.rb
active_administration-0.0.1 spec/unit/views/components/panel_spec.rb