Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for title prefix #2602

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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