From 83246df508a0b93ae867270c4a44a0353f417dcd Mon Sep 17 00:00:00 2001
From: Jack Reed <phillipjreed@gmail.com>
Date: Fri, 22 May 2020 10:45:09 -0600
Subject: [PATCH] Use chars instead of values for OpenAnnotation
---
__tests__/src/lib/AnnotationResource.test.js | 4 ++--
src/lib/AnnotationResource.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/__tests__/src/lib/AnnotationResource.test.js b/__tests__/src/lib/AnnotationResource.test.js
index 9fd5cb941..b0710eb5f 100644
--- a/__tests__/src/lib/AnnotationResource.test.js
+++ b/__tests__/src/lib/AnnotationResource.test.js
@@ -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']);
});
diff --git a/src/lib/AnnotationResource.js b/src/lib/AnnotationResource.js
index 2a9437521..593a2c2dc 100644
--- a/src/lib/AnnotationResource.js
+++ b/src/lib/AnnotationResource.js
@@ -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);
}
/** */
--
GitLab