Skip to content

Commit

Permalink
Merge pull request #2602 from projectblacklight/prefix_test
Browse files Browse the repository at this point in the history
Add test for title prefix
  • Loading branch information
barmintor committed May 3, 2022
2 parents 587767d + bcd8b91 commit ed830f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/components/blacklight/document_title_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<header class="documentHeader row">
<%= content_tag @as, class: @classes do %>
<% before_title.each do |t| %>
<% before_titles.each do |t| %>
<%= t %>
<% end %>
<%= counter -%><%= title -%>
<% after_title.each do |t| %>
<% after_titles.each do |t| %>
<%= t %>
<% end %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/components/blacklight/document_title_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module Blacklight
class DocumentTitleComponent < Blacklight::Component
renders_many :before_title
renders_many :after_title
renders_many :before_titles
renders_many :after_titles
renders_many :actions

# rubocop:disable Metrics/ParameterLists
Expand Down
14 changes: 14 additions & 0 deletions spec/components/blacklight/document_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,18 @@ def call
component.partial { 'Partials' }
expect(rendered).to have_content 'Partials'
end

context 'with before_title' do
let(:render) do
component.render_in(view_context) do
component.title do |c|
c.before_title { 'Prefix!' }
end
end
end

it 'shows the prefix' do
expect(rendered).to have_content "Prefix!"
end
end
end

0 comments on commit ed830f8

Please sign in to comment.