-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a skeleton viewer for the new designs
- Loading branch information
Showing
9 changed files
with
107 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* TODO add styles */ |
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,7 @@ | ||
<%= render ::CompanionWindowsComponent.new(viewer:, stimulus_controller: 'file-auth fullscreen') do |component| %> | ||
<% component.with_body do %> | ||
<div class="sul-embed-body" style="width: 100%"> | ||
<%= render ::ContentNotAvailableComponent.new %> | ||
</div> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class WasSeedComponent < ViewComponent::Base | ||
def initialize(viewer:) | ||
@viewer = viewer | ||
end | ||
|
||
attr_reader :viewer | ||
|
||
delegate :purl_object, to: :viewer | ||
delegate :druid, to: :purl_object | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: Add code here |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe WasSeedComponent, type: :component do | ||
include WasTimeMapFixtures | ||
|
||
let(:embed_request) do | ||
Embed::Request.new(url: 'http://purl.stanford.edu/abc123', new_viewer: 'true') | ||
end | ||
let(:viewer) { Embed::Viewer::WasSeed.new(embed_request) } | ||
let(:purl) { build(:purl, :was_seed) } | ||
|
||
before do | ||
allow(Embed::Purl).to receive(:find).and_return(purl) | ||
end | ||
|
||
context 'with current timemap behavior' do | ||
let(:fake_connection) do | ||
instance_double(Faraday::Connection, get: instance_double(Faraday::Response, body: timemap, success?: true)) | ||
end | ||
|
||
before do | ||
allow_any_instance_of(Embed::WasTimeMap).to receive(:redirectable_connection).and_return(fake_connection) | ||
expect(fake_connection).to receive(:get).once | ||
render_inline(described_class.new(viewer:)) | ||
end | ||
|
||
it 'displays Was Seed viewer body' do | ||
# visible false because we display:none the container until we've loaded the CSS. | ||
expect(page).to have_css '.sul-embed-was-seed', visible: :all | ||
expect(page).to have_css '.sul-embed-was-seed-list', visible: :all, count: 1 | ||
expect(page).to have_css '.sul-embed-was-seed-list-item', visible: :all, count: 7 | ||
end | ||
|
||
context 'with hidden title' do | ||
let(:embed_request) do | ||
Embed::Request.new(url: 'http://purl.stanford.edu/abc123', hide_title: 'true') | ||
end | ||
|
||
it do | ||
expect(page).to have_no_css '.sul-embed-header', visible: :all | ||
end | ||
end | ||
end | ||
|
||
context 'with new timemap behavior' do | ||
let(:fake_connection) do | ||
instance_double(Faraday::Connection, get: instance_double(Faraday::Response, body: timemap_new, success?: true)) | ||
end | ||
|
||
before do | ||
allow_any_instance_of(Embed::WasTimeMap).to receive(:redirectable_connection).and_return(fake_connection) | ||
expect(fake_connection).to receive(:get).once | ||
render_inline(described_class.new(viewer:)) | ||
end | ||
|
||
it 'displays Was Seed viewer body' do | ||
# visible false because we display:none the container until we've loaded the CSS. | ||
expect(page).to have_css '.sul-embed-was-seed', visible: :all | ||
expect(page).to have_css '.sul-embed-was-seed-list', visible: :all, count: 1 | ||
expect(page).to have_css '.sul-embed-was-seed-list-item', visible: :all, count: 7 | ||
end | ||
|
||
context 'with hidden title' do | ||
let(:embed_request) do | ||
Embed::Request.new(url: 'http://purl.stanford.edu/abc123', hide_title: 'true') | ||
end | ||
|
||
it do | ||
expect(page).to have_no_css '.sul-embed-header', visible: :all | ||
end | ||
end | ||
end | ||
end |