Commit e77d9fa9 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner

Add `isHidden` function

parent d495aad3
......@@ -149,6 +149,16 @@ export function isWaitingToAnchor(annotation) {
);
}
/**
* Has this annotation hidden by moderators?
*
* @param {Object} annotation
* @return {boolean}
*/
export function isHidden(annotation) {
return !!annotation.hidden;
}
/**
* Is this annotation a highlight?
*
......
......@@ -234,6 +234,24 @@ describe('annotation-metadata', function() {
});
});
describe('.isHidden', () => {
it('returns `true` if annotation has been hidden', () => {
const annotation = fixtures.moderatedAnnotation({ hidden: true });
assert.isTrue(annotationMetadata.isHidden(annotation));
});
[
fixtures.newEmptyAnnotation(),
fixtures.newReply(),
fixtures.newHighlight(),
fixtures.oldAnnotation(),
].forEach(nonHiddenAnnotation => {
it('returns `false` if annotation is not hidden', () => {
assert.isFalse(annotationMetadata.isHidden(nonHiddenAnnotation));
});
});
});
describe('.isHighlight', () => {
[
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment