Unverified Commit ec5d1b01 authored by Lyza Gardner's avatar Lyza Gardner Committed by GitHub

Merge pull request #1871 from hypothesis/annotation-omega-is-saving

AnnotationOmega: Add “Saving…” message
parents d2501f0c 09938c10
......@@ -68,7 +68,7 @@ function AnnotationOmega({
}
}, [annotation, draft, createDraft, isSaving]);
const shouldShowActions = !isEditing && !isNew(annotation);
const shouldShowActions = !isSaving && !isEditing && !isNew(annotation);
const shouldShowLicense = isEditing && !isPrivate && group.type !== 'private';
const shouldShowReplyToggle = replyCount > 0 && !isReply(annotation);
......@@ -159,6 +159,9 @@ function AnnotationOmega({
buttonText={toggleText}
/>
)}
{isSaving && (
<div className="annotation-omega__actions">Saving...</div>
)}
{shouldShowActions && (
<div className="annotation-omega__actions">
<AnnotationActionBar annotation={annotation} onReply={onReply} />
......
......@@ -93,8 +93,6 @@ describe('AnnotationOmega', () => {
$imports.$restore();
});
it('should test `isSaving`');
describe('annotation classnames', () => {
it('should assign a reply class if the annotation is a reply', () => {
fakeMetadata.isReply.returns(true);
......@@ -238,6 +236,25 @@ describe('AnnotationOmega', () => {
);
});
it('should show a "Saving" message when annotation is saving', () => {
setEditingMode(true);
const wrapper = createComponent();
act(() => {
wrapper
.find('AnnotationPublishControl')
.props()
.onSave();
});
wrapper.update();
assert.include(
wrapper.find('.annotation-omega__actions').text(),
'Saving...'
);
});
it('should flash an error message on failure', async () => {
setEditingMode(true);
fakeAnnotationsService.save.rejects();
......
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