Skip to content

Commit

Permalink
Allow the openseadgragon view to accept more flexible view_config
Browse files Browse the repository at this point in the history
  • Loading branch information
marlo-longley committed Sep 16, 2024
1 parent 4948135 commit 074b2a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/views/catalog/_openseadragon_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%
image = document.to_openseadragon(blacklight_config.view_config(:show))
view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type)
image = document.to_openseadragon(view_config)
id_prefix = osd_html_id_prefix
%>
<%
Expand Down
21 changes: 13 additions & 8 deletions spec/views/catalog/_openseadragon_default.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
require 'spec_helper'

describe "catalog/openseadragon_default" do
describe 'catalog/openseadragon_default' do
let(:document) { SolrDocument.new }
let(:blacklight_config) { Blacklight::Configuration.new }
let(:p) { "catalog/openseadragon_default" }
let(:p) { 'catalog/openseadragon_default' }

before do
allow(view).to receive_messages(blacklight_config: blacklight_config, openseadragon_picture_tag: "<img />")
allow(document).to receive_messages(to_openseadragon: [])
allow(view).to receive_messages(
blacklight_config: blacklight_config,
documents: [document],
document_index_view_type: 'embed',
openseadragon_picture_tag: '<img />'
)
end

it "should render the openseadragon container" do
it 'should render the openseadragon container' do
render partial: p, locals: { document: document }
expect(rendered).to have_selector ".openseadragon-container"
expect(rendered).to have_selector '.openseadragon-container'
end

it "should support passing a container class" do
render partial: p, locals: { document: document, osd_container_class: "custom-container" }
expect(rendered).to have_selector ".custom-container"
it 'should support passing a container class' do
render partial: p, locals: { document: document, osd_container_class: 'custom-container' }
expect(rendered).to have_selector '.custom-container'
end
end

0 comments on commit 074b2a4

Please sign in to comment.