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

Support multivalued metadata fields fixes #2591

parent 328c8499
Branches
Tags
No related merge requests found
......@@ -13,11 +13,11 @@ describe('LabelValueMetadata', () => {
labelValuePair = [
{
label: 'Label 1',
value: 'Value 1',
values: ['Value 1'],
},
{
label: 'Label 2',
value: 'Value 2',
values: ['Value 2'],
},
];
wrapper = shallow(
......@@ -67,11 +67,11 @@ describe('LabelValueMetadata', () => {
beforeEach(() => {
labelValuePair = [
{
value: 'Value 1',
values: ['Value 1'],
},
{
label: 'Label 2',
value: 'Value 2',
values: ['Value 2'],
},
];
wrapper = shallow(
......
......@@ -247,7 +247,7 @@ describe('getDestructuredMetadata', () => {
const received = getDestructuredMetadata(iiifResource);
const expected = [{
label: 'date',
value: 'some date',
values: ['some date'],
}];
expect(received).toEqual(expected);
......@@ -267,7 +267,7 @@ describe('getManifestMetadata', () => {
const received = getManifestMetadata(state, { manifestId: 'x' });
const expected = [{
label: 'date',
value: 'some date',
values: ['some date'],
}];
expect(received).toEqual(expected);
......
......@@ -29,7 +29,7 @@ export class LabelValueMetadata extends Component {
{labelValuePairs.reduce((acc, labelValuePair, i) => acc.concat([
<Typography component="dt" key={`label-${i}`} variant="subtitle2">{labelValuePair.label || defaultLabel}</Typography>,
<Typography style={{ marginBottom: '.5em', marginLeft: '0px' }} component="dd" key={`value-${i}`} variant="body1">
<SanitizedHtml htmlString={labelValuePair.value} ruleSet="iiif" />
<SanitizedHtml htmlString={labelValuePair.values.join(', ')} ruleSet="iiif" />
</Typography>,
]), [])}
</dl>
......
......@@ -288,7 +288,7 @@ export function getDestructuredMetadata(iiifResource) {
return (iiifResource
&& iiifResource.getMetadata().map(labelValuePair => ({
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 to comment