Skip to content
Snippets Groups Projects
Commit 69e7945c authored by Jack Reed's avatar Jack Reed Committed by Chris Beer
Browse files

Use getValues everywhere for potential of multiple values

parent 3407d3d6
No related branches found
No related tags found
No related merge requests found
...@@ -329,10 +329,10 @@ describe('getRequiredStatement', () => { ...@@ -329,10 +329,10 @@ describe('getRequiredStatement', () => {
it('gets the attribution data for a IIIF v2 manifest', () => { it('gets the attribution data for a IIIF v2 manifest', () => {
const state = { manifests: { x: { json: manifestFixture001 } } }; const state = { manifests: { x: { json: manifestFixture001 } } };
const received = getRequiredStatement(state, { manifestId: 'x' }); const received = getRequiredStatement(state, { manifestId: 'x' });
expect(received).toEqual([{ label: null, value: 'http://creativecommons.org/licenses/by-nc-sa/3.0/.' }]); expect(received).toEqual([{ label: null, values: ['http://creativecommons.org/licenses/by-nc-sa/3.0/.'] }]);
}); });
it('suppresses empty the attribution data', () => { it('suppresses empty attribution data', () => {
const state = { manifests: { x: { json: manifestFixture002 } } }; const state = { manifests: { x: { json: manifestFixture002 } } };
const received = getRequiredStatement(state, { manifestId: 'x' }); const received = getRequiredStatement(state, { manifestId: 'x' });
expect(received).toEqual([]); expect(received).toEqual([]);
...@@ -341,7 +341,7 @@ describe('getRequiredStatement', () => { ...@@ -341,7 +341,7 @@ describe('getRequiredStatement', () => {
it('gets the required statement data for a IIIF v3 manifest', () => { it('gets the required statement data for a IIIF v3 manifest', () => {
const state = { manifests: { x: { json: manifestFixturev3001 } } }; const state = { manifests: { x: { json: manifestFixturev3001 } } };
const received = getRequiredStatement(state, { manifestId: 'x' }); const received = getRequiredStatement(state, { manifestId: 'x' });
expect(received).toEqual([{ label: 'Terms of Use', value: 'None' }]); expect(received).toEqual([{ label: 'Terms of Use', values: ['None'] }]);
}); });
}); });
......
...@@ -191,9 +191,11 @@ export const getManifestRelatedContent = createSelector( ...@@ -191,9 +191,11 @@ export const getManifestRelatedContent = createSelector(
export const getRequiredStatement = createSelector( export const getRequiredStatement = createSelector(
[getManifestoInstance], [getManifestoInstance],
manifest => manifest manifest => manifest
&& asArray(manifest.getRequiredStatement()).filter(l => l.getValue()).map(labelValuePair => ({ && asArray(manifest.getRequiredStatement())
.filter(l => l.getValues().some(v => v))
.map(labelValuePair => ({
label: labelValuePair.getLabel(), label: labelValuePair.getLabel(),
value: labelValuePair.getValue(), values: labelValuePair.getValues(),
})), })),
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment