Skip to content
Snippets Groups Projects
Unverified Commit 7f7835cd authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #2938 from ProjectMirador/sequenceless-manifests

Guard against manifests without sequences
parents 4f426e94 9ae3262d
No related branches found
No related tags found
No related merge requests found
{
"@context" : "http://iiif.io/api/presentation/2/context.json",
"@id" : "https://www.loc.gov/item/2017498721/manifest.json",
"viewingHint" : "paged",
"metadata" : [
{
"label" : "APA Citation Style",
"value" : "Ṣalāḥ Al-Dīn Bak, M. &amp; Eltaher Collection. (1949) <cite>1. al-Jāmiʻah al-ʻArabīyah wa-aḥdāth Filasṭīn ; 2. al-Qaḍīyah al-Filasṭīnīyah amāma Lajnat al-tawfīq</cite>. [Cairo?: Maṭbaʻat Fāḍil] [Pdf] Retrieved from the Library of Congress, https://www.loc.gov/item/2017498721/."
},
{
"label" : "MLA Citation Style",
"value" : "Ṣalāḥ Al-Dīn Bak, Muḥammad, Author, and Eltaher Collection. <cite>1. al-Jāmiʻah al-ʻArabīyah wa-aḥdāth Filasṭīn ; 2. al-Qaḍīyah al-Filasṭīnīyah amāma Lajnat al-tawfīq</cite>. [Cairo?: Maṭbaʻat Fāḍil, 1949] Pdf. Retrieved from the Library of Congress, &lt;www.loc.gov/item/2017498721/&gt;."
},
{
"label" : "Chicago Citation Style",
"value" : "Ṣalāḥ Al-Dīn Bak, Muḥammad, Author, and Eltaher Collection. <cite>1. al-Jāmiʻah al-ʻArabīyah wa-aḥdāth Filasṭīn ; 2. al-Qaḍīyah al-Filasṭīnīyah amāma Lajnat al-tawfīq</cite>. [Cairo?: Maṭbaʻat Fāḍil, 1949] Pdf. https://www.loc.gov/item/2017498721/."
},
{
"label" : "Contributors",
"value" : [
"Ṣalāḥ al-Dīn Bak, Muḥammad, author.",
"Eltaher Collection (Library of Congress)"
]
},
{
"label" : "Created Published",
"value" : [
"[Cairo?] : Maṭbaʻat Fāḍil, [1949]"
]
},
{
"value" : [
"book"
],
"label" : "Original Format"
},
{
"value" : [
"palestine",
"politics and government",
"arab-israeli conflict",
"sources"
],
"label" : "Subjects"
},
{
"value" : [
"image",
"pdf"
],
"label" : "Online Format"
},
{
"label" : "Item Url",
"value" : "https://www.loc.gov/item/2017498721/"
}
],
"logo" : "https://loc.gov/static/images/logo-loc-new-branding.svg",
"seeAlso" : [
{
"@id" : "https://lccn.loc.gov/2017498721/marcxml",
"format" : "text/xml"
},
{
"@id" : "https://lccn.loc.gov/2017498721/mods",
"format" : "text/xml"
},
{
"format" : "text/html",
"@id" : "https://lccn.loc.gov/2017498721/dc"
}
],
"navDate" : "1949-01-01:T00:00:00Z",
"attribution" : "Provided by the Library of Congress",
"viewingDirection" : "left-to-right",
"description" : "In Arabic.",
"thumbnail" : {
"@id" : "https://cdn.loc.gov/service/amed/amedeltaher/2017498721/2017498721.gif"
},
"label" : "1. al-Jāmiʻah al-ʻArabīyah wa-aḥdāth Filasṭīn ; 2. al-Qaḍīyah al-Filasṭīnīyah amāma Lajnat al-tawfīq",
"@type" : "sc:Manifest"
}
...@@ -7,6 +7,7 @@ import manifestFixtureSn904cj3429 from '../../fixtures/version-2/sn904cj3429.jso ...@@ -7,6 +7,7 @@ import manifestFixtureSn904cj3429 from '../../fixtures/version-2/sn904cj3429.jso
import manifestFixturev3001 from '../../fixtures/version-3/001.json'; import manifestFixturev3001 from '../../fixtures/version-3/001.json';
import manifestFixtureWithAProvider from '../../fixtures/version-3/with_a_provider.json'; import manifestFixtureWithAProvider from '../../fixtures/version-3/with_a_provider.json';
import manifestFixtureFg165hz3589 from '../../fixtures/version-2/fg165hz3589.json'; import manifestFixtureFg165hz3589 from '../../fixtures/version-2/fg165hz3589.json';
import manifestFixture2017498721 from '../../fixtures/version-2/2017498721.json';
import { import {
getManifestoInstance, getManifestoInstance,
getManifestLocale, getManifestLocale,
...@@ -487,6 +488,11 @@ describe('getManifestViewingHint', () => { ...@@ -487,6 +488,11 @@ describe('getManifestViewingHint', () => {
expect(getManifestViewingHint(state, { manifestId: 'x' })).toEqual('individuals'); expect(getManifestViewingHint(state, { manifestId: 'x' })).toEqual('individuals');
}); });
it('gets from the manifest if this is no sequence', () => {
const state = { manifests: { x: { json: manifestFixture2017498721 } } };
expect(getManifestViewingHint(state, { manifestId: 'x' })).toEqual('paged');
});
it('gets from the sequence', () => { it('gets from the sequence', () => {
const state = { manifests: { x: { json: manifestFixture015 } } }; const state = { manifests: { x: { json: manifestFixture015 } } };
expect(getManifestViewingHint(state, { manifestId: 'x' })).toEqual('paged'); expect(getManifestViewingHint(state, { manifestId: 'x' })).toEqual('paged');
......
...@@ -410,7 +410,8 @@ export const getManifestViewingHint = createSelector( ...@@ -410,7 +410,8 @@ export const getManifestViewingHint = createSelector(
[getManifestoInstance], [getManifestoInstance],
(manifest) => { (manifest) => {
if (!manifest) return null; if (!manifest) return null;
const viewingHint = manifest.getSequences()[0].getViewingHint() || manifest.getViewingHint(); const viewingHint = (manifest.getSequences()[0] && manifest.getSequences()[0].getViewingHint())
|| manifest.getViewingHint();
if (viewingHint) return viewingHint.value; if (viewingHint) return viewingHint.value;
return null; return null;
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment