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

Use chars instead of values for OpenAnnotation

parent d1f19ba7
Branches
Tags
No related merge requests found
......@@ -26,14 +26,14 @@ describe('AnnotationResource', () => {
describe('tags', () => {
it('when only motivation', () => {
expect(
new AnnotationResource({ resource: [{ '@type': 'oa:Tag', value: 'yo' }, { '@type': 'oa:Tag', value: 'lo' }] }).tags,
new AnnotationResource({ resource: [{ '@type': 'oa:Tag', chars: 'yo' }, { '@type': 'oa:Tag', chars: 'lo' }] }).tags,
).toEqual(['yo', 'lo']);
});
it('when multiple motivations', () => {
expect(
new AnnotationResource({
motivation: ['oa:commenting', 'oa:tagging'],
resource: [{ '@type': 'oa:commenting', value: 'yo' }, { '@type': 'oa:Tag', value: 'lo' }],
resource: [{ '@type': 'oa:commenting', chars: 'yo' }, { '@type': 'oa:Tag', chars: 'lo' }],
}).tags,
).toEqual(['lo']);
});
......
......@@ -53,9 +53,9 @@ export default class AnnotationResource {
/** */
get tags() {
if (this.isOnlyTag()) {
return this.resources.map(r => r.value);
return this.resources.map(r => r.chars);
}
return this.resources.filter(r => r['@type'] === 'oa:Tag').map(r => r.value);
return this.resources.filter(r => r['@type'] === 'oa:Tag').map(r => r.chars);
}
/** */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment