Commit 4e5d6a59 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Include highlight quote text in hidden toast message

parent 1afc7062
import { quote } from '../helpers/annotation-metadata';
import type { SidebarStore } from '../store'; import type { SidebarStore } from '../store';
import { retryPromiseOperation } from '../util/retry'; import { retryPromiseOperation } from '../util/retry';
import type { AnnotationsService } from './annotations'; import type { AnnotationsService } from './annotations';
...@@ -65,7 +66,7 @@ export class AutosaveService { ...@@ -65,7 +66,7 @@ export class AutosaveService {
retryPromiseOperation(() => this._annotationsService.save(highlight)) retryPromiseOperation(() => this._annotationsService.save(highlight))
.then(() => { .then(() => {
this._toastMessenger.success('Highlight saved', { this._toastMessenger.success(`Highlighted "${quote(highlight)}"`, {
visuallyHidden: true, visuallyHidden: true,
}); });
}) })
......
...@@ -31,8 +31,19 @@ describe('AutosaveService', () => { ...@@ -31,8 +31,19 @@ describe('AutosaveService', () => {
* Make `fakeStore.newHighlights` return a single highlight fixture. * Make `fakeStore.newHighlights` return a single highlight fixture.
*/ */
const oneNewHighlight = () => { const oneNewHighlight = () => {
const newHighlight = annotationFixtures.newHighlight(); const newHighlight = Object.assign(annotationFixtures.newHighlight(), {
newHighlight.$tag = 'deadbeef'; $tag: 'deadbeef',
target: [
{
selector: [
{
type: 'TextQuoteSelector',
exact: 'Quote',
},
],
},
],
});
fakeStore.newHighlights.returns([newHighlight]); fakeStore.newHighlights.returns([newHighlight]);
return newHighlight; return newHighlight;
}; };
...@@ -73,7 +84,7 @@ describe('AutosaveService', () => { ...@@ -73,7 +84,7 @@ describe('AutosaveService', () => {
await waitFor(() => !svc.isSaving()); await waitFor(() => !svc.isSaving());
assert.calledOnce(fakeToastMessenger.success); assert.calledOnce(fakeToastMessenger.success);
assert.calledWith(fakeToastMessenger.success, 'Highlight saved', { assert.calledWith(fakeToastMessenger.success, 'Highlighted "Quote"', {
visuallyHidden: true, visuallyHidden: true,
}); });
}); });
......
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