Skip to content

Commit

Permalink
Merge pull request #3806 from sul-dlss/3795-context-box
Browse files Browse the repository at this point in the history
wrap collection summary in helpers.format_record_html
  • Loading branch information
jcoyne authored Jan 29, 2024
2 parents 2ca1f1d + f9095bb commit eceef76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/access_panels/collection_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h4><%= link_to(helpers.document_presenter(@collection).heading, solr_document_path(@collection[:id])) %></h4>
<% if @collection[:summary_display] %>
<div data-behavior='truncate'>
<%= @collection[:summary_display].join(', ') %>
<%= helpers.format_record_html(@collection[:summary_display].join(', ')) %>
</div>
<% end %>
<dl class="dl-invert">
Expand Down
16 changes: 16 additions & 0 deletions spec/components/access_panels/in_collection_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@
expect(page).to have_no_content("Digital content")
end
end

describe 'merged records with collection members that have encoded summaries' do
let(:document) { SolrDocument.new(id: '1') }
let(:parent) { SolrDocument.new(id: '2', summary_display: ['Summary &amp; Display']) }

before do
allow(document).to receive_messages(parent_collections: [parent])
render_inline(described_class.new(document:))
end

it 'renders summary display with summary display encoded properly' do
expect(page).to have_css("h3", text: 'Item belongs to a collection')
expect(page).to have_css("div.card-body", text: 'Summary & Display')
expect(page).to have_no_content("Digital content")
end
end
end

0 comments on commit eceef76

Please sign in to comment.