Skip to content

Commit

Permalink
Add support for content as block for SubtitleComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
diegotoral committed Feb 7, 2024
1 parent 7b9a0ba commit d20d35a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/bulma/subtitle_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(text = nil)
end

def call
content_tag :p, @text, class: "subtitle"
content_tag :p, @text || content, class: "subtitle"
end
end
end
6 changes: 6 additions & 0 deletions spec/components/bulma/subtitle_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@

expect(page).to have_content "Subtitle"
end

it "render content provided as a block" do
render_inline(described_class.new) { "Subtitle" }

expect(page).to have_content "Subtitle"
end
end

0 comments on commit d20d35a

Please sign in to comment.