Skip to content
Snippets Groups Projects
Commit 6c9f4d29 authored by Johannes Baiter's avatar Johannes Baiter
Browse files

Fix rendering of within fields with an array value

parent 2d4a9080
Branches
Tags
No related merge requests found
......@@ -169,7 +169,7 @@
var collectionLabel = within.label || collectionUrl;
return '<a href="' + collectionUrl + '" target="_blank">' + collectionLabel + '</a>';
} else if (within instanceof Array) {
return within.map(this.getWithin).join("<br/>");
return within.map(this.getWithin, this).join("<br/>");
} else {
return this.stringifyObject(within);
}
......
......
......@@ -85,7 +85,7 @@ describe('MetadataView', function() {
});
describe('renderWithin', function() {
it('should render simple strings as-sis', function() {
it('should render simple strings as-is', function() {
var within = "http://example.com";
expect(Mirador.MetadataView.prototype.getWithin(within)).toBe(within);
});
......@@ -110,5 +110,11 @@ describe('MetadataView', function() {
'<a href="http://example.com" target="_blank">foobar</a><br/>' +
'<a href="http://foo.org" target="_blank">barfoo</a>');
});
it('should render a list of strings <br/>-concatenated', function() {
var within = ['http://example.com/foo', 'http://example.com/bar'];
expect(Mirador.MetadataView.prototype.getWithin(within)).toBe(
'http://example.com/foo<br/>http://example.com/bar');
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment