diff --git a/app/assets/javascripts/arclight/context_navigation.js b/app/assets/javascripts/arclight/context_navigation.js
index d0916c516..8a51f4cc5 100644
--- a/app/assets/javascripts/arclight/context_navigation.js
+++ b/app/assets/javascripts/arclight/context_navigation.js
@@ -123,20 +123,27 @@ class ContextNavigation {
this.data = this.el.data();
this.parentLi = this.el.parent();
this.eadid = this.data.arclight.eadid;
- this.originalParents = originalParents || this.data.arclight.originalParents;
+ this.originalParents = originalParents; // let originalParents stay null
this.originalDocument = originalDocument || this.data.arclight.originalDocument;
this.ul = $('
');
}
// Gets the targetId to select, based off of parents and current level
get targetId() {
- return `${this.eadid}${this.originalParents[this.data.arclight.level]}`;
+ if (this.originalParents && this.originalParents[this.data.arclight.level]) {
+ return `${this.eadid}${this.originalParents[this.data.arclight.level]}`;
+ }
+ return this.data.arclight.originalDocument;
}
get requestParent() {
+ // Cases where you're viewing a component page (use its ancestor trail)...
if (this.originalParents && this.originalParents[this.data.arclight.level - 1]) {
return this.originalParents[this.data.arclight.level - 1];
}
+ // Cases where there are no parents provided...
+ // 1) when on a top-level collection page
+ // 2) when +/- gets clicked
return this.data.arclight.originalDocument.replace(this.eadid, '');
}
@@ -353,7 +360,10 @@ class ContextNavigation {
if (!targetArea.data().resolved) {
targetArea.find('.context-navigator').each((i, ee) => {
const contextNavigation = new ContextNavigation(
- ee, that.originalParents, that.originalDocument
+ // Send null for originalParents. We want to disregard the original
+ // component's ancestor trail and instead use the current ID as the
+ // parent in the query to populate the navigator.
+ ee, null, that.originalDocument
);
contextNavigation.getData();
});
@@ -368,7 +378,9 @@ class ContextNavigation {
*/
Blacklight.onLoad(function () {
$('.context-navigator').each(function (i, e) {
- const contextNavigation = new ContextNavigation(e);
+ const contextNavigation = new ContextNavigation(
+ e, $(this).data('arclight').originalParents, $(this).data('arclight').originalDocument
+ );
contextNavigation.getData();
});
});
diff --git a/spec/features/component_page_spec.rb b/spec/features/component_page_spec.rb
index 9e2423f35..46e88b0d4 100644
--- a/spec/features/component_page_spec.rb
+++ b/spec/features/component_page_spec.rb
@@ -197,6 +197,17 @@
end
end
end
+
+ context 'when on a deeply nested component' do
+ let(:doc_id) { 'aoa271aspace_6ea193f778e553ca9ea0d00a3e5a1891' }
+
+ it 'enables expanding nodes outside of own ancestor tree' do
+ within '#collection-context' do
+ find('#aoa271aspace_01daa89087641f7fc9dbd7a10d3f2da9 .al-toggle-view-children').click
+ expect(page).to have_css '.document-title-heading', text: 'Miscellaneous 1999'
+ end
+ end
+ end
end
describe 'access tab', js: true do
diff --git a/spec/features/search_breadcrumb_spec.rb b/spec/features/search_breadcrumb_spec.rb
index 6f5566cf4..474b47e84 100644
--- a/spec/features/search_breadcrumb_spec.rb
+++ b/spec/features/search_breadcrumb_spec.rb
@@ -11,8 +11,7 @@
expect(page).to have_content 'Search results'
end
end
- end
- context 'on regular search results' do
+
it do
visit search_catalog_path f: { level_sim: ['Collection'] }, search_field: 'all_fields'
within '.al-search-breadcrumb' do
diff --git a/spec/presenters/arclight/index_presenter_spec.rb b/spec/presenters/arclight/index_presenter_spec.rb
index 5b31feb4d..f3ce9689e 100644
--- a/spec/presenters/arclight/index_presenter_spec.rb
+++ b/spec/presenters/arclight/index_presenter_spec.rb
@@ -17,10 +17,6 @@
end
before do
- expect(view_context).to receive_messages(
- controller: instance_double('Controller', params: {}, session: {}),
- default_document_index_view_type: 'index'
- )
config.index.title_field = :normalized_title_ssm
end