-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathpanel_spec.rb
More file actions
52 lines (43 loc) · 1.25 KB
/
panel_spec.rb
File metadata and controls
52 lines (43 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
require "rails_helper"
RSpec.describe ActiveAdmin::Views::Panel do
let(:arbre_panel) do
render_arbre_component do
panel "My Title" do
span("Hello World")
end
end
end
let(:panel_html) { Capybara.string(arbre_panel.to_s) }
it "should have a title h3" do
expect(panel_html).to have_css "h3", text: "My Title"
end
it "should have a contents div" do
expect(panel_html).to have_css "div.panel-body"
end
it "should add children to the contents div" do
expect(panel_html).to have_css "div.panel-body > span", text: "Hello World"
end
context "with html-safe title" do
let(:arbre_panel) do
title_with_html = %q[Title with <abbr>HTML</abbr>].html_safe
render_arbre_component do
panel(title_with_html)
end
end
it "should allow a html_safe title" do
expect(panel_html).to have_css "h3", text: "Title with HTML"
expect(panel_html).to have_css "h3 > abbr", text: "HTML"
end
end
describe "#children?" do
let(:arbre_panel) do
render_arbre_component do
panel("A Panel")
end
end
it "returns false if no children have been added to the panel" do
expect(arbre_panel.children?).to eq false
end
end
end