-
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
70 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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module Embed | ||
class WasSeedComponent < ViewComponent::Base | ||
def initialize(viewer:) | ||
@viewer = viewer | ||
end | ||
|
||
attr_reader :viewer | ||
|
||
delegate :purl_object, to: :viewer | ||
delegate :druid, to: :purl_object | ||
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 @@ | ||
// 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,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Embed::PdfComponent, type: :component do | ||
include PurlFixtures | ||
|
||
let(:url) { 'https://purl.stanford.edu/sq929fn8035' } | ||
let(:embed_request) { Embed::Request.new(url:) } | ||
let(:viewer) { Embed::ViewerFactory.new(embed_request).viewer } | ||
|
||
before do | ||
stub_request(:get, 'https://purl.stanford.edu/sq929fn8035.json') | ||
.to_return(status: 200, body: pdf_public_json, headers: {}) | ||
end | ||
|
||
it 'renders the full screen button by default' do | ||
rendered_ng_doc_fragment = render_inline(described_class.new(viewer:)) | ||
expect(rendered_ng_doc_fragment.xpath('.//button[@id="full-screen-button" and @aria-label="Full screen"]').count).to eq(1) | ||
end | ||
|
||
context 'when the browser is chromium based' do | ||
let(:companion_windows_component) { CompanionWindowsComponent.new(viewer:, stimulus_controller: 'file-auth') } | ||
|
||
before do | ||
allow(CompanionWindowsComponent).to receive(:new).with(viewer:, stimulus_controller: 'file-auth fullscreen').and_return(companion_windows_component) | ||
allow(companion_windows_component).to receive(:requested_by_chromium?).and_return(true) | ||
end | ||
|
||
it 'does not render the full screen button' do | ||
rendered_ng_doc_fragment = render_inline(described_class.new(viewer:)) | ||
expect(rendered_ng_doc_fragment.xpath('.//button[@id="full-screen-button"]').count).to eq(0) | ||
expect(rendered_ng_doc_fragment.xpath('.//button[@aria-label="Full screen"]').count).to eq(0) | ||
end | ||
end | ||
end |