-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HYC-2048 - Fix rendering of department with multiple terms (#1149)
* Add test * Treat term as an array so that we can deal with vocab entries that return a single or multiple terms * Debug warning to debug * Fix term delimiter
- Loading branch information
Showing
5 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
spec/renderers/hyrax/renderers/person_attribute_renderer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Hyrax::Renderers::PersonAttributeRenderer do | ||
describe '#render_dl_row' do | ||
subject { Nokogiri::HTML(renderer.render_dl_row) } | ||
|
||
let(:expected) { Nokogiri::HTML(tr_content) } | ||
|
||
context 'with department a single term' do | ||
let(:field) { :creator_display } | ||
let(:renderer) { described_class.new(field, ['index:1||art, person||Affiliation: Art History']) } | ||
let(:tr_content) do | ||
%( | ||
<dt>Creator display</dt> | ||
<dd> | ||
<ul class="tabular"> | ||
<li itemprop="creator" itemtype="http://schema.org/Person" class="attribute attribute-creator_display"> | ||
<span>art, person</span> | ||
<ul> | ||
<li>College of Arts and Sciences, Department of Art and Art History, Art History</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</dd> | ||
) | ||
end | ||
|
||
it { expect(subject).to be_equivalent_to(expected) } | ||
end | ||
|
||
context 'with department containing multiple terms' do | ||
let(:field) { :creator_display } | ||
let(:renderer) { described_class.new(field, ['index:1||person||Affiliation: Joint Department of Biomedical Engineering']) } | ||
let(:tr_content) do | ||
%( | ||
<dt>Creator display</dt> | ||
<dd> | ||
<ul class="tabular"> | ||
<li itemprop="creator" itemtype="http://schema.org/Person" class="attribute attribute-creator_display"> | ||
<span>person</span> | ||
<ul> | ||
<li>School of Medicine, Joint Department of Biomedical Engineering</li> | ||
<li>North Carolina State University, Joint Department of Biomedical Engineering</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</dd> | ||
) | ||
end | ||
|
||
it { expect(subject).to be_equivalent_to(expected) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters