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