Commit 7706b6b4 authored by Robert Knight's avatar Robert Knight

Reset store annotations on `FrameSyncService.hoverAnnotations(null)`

Ensure that hovered annotations are cleared in the store when `null` is
passed to `FrameSyncService.hoverAnnotations`.
parent 99c414b4
......@@ -530,14 +530,14 @@ export class FrameSyncService {
hoverAnnotation(ann: Annotation | null) {
this._pendingHoverTag = null;
const tags = ann ? [ann.$tag] : [];
this._store.hoverAnnotations(tags);
if (!ann) {
this._guestRPC.forEach(rpc => rpc.call('hoverAnnotations', []));
return;
}
const tags = ann ? [ann.$tag] : [];
this._store.hoverAnnotations(tags);
// If annotation is not currently anchored in a guest, schedule hover for
// when annotation is anchored. This can happen if an annotation is for a
// different chapter of an EPUB than the currently loaded one. See notes in
......
......@@ -926,6 +926,9 @@ describe('FrameSyncService', () => {
fakeStore.hoverAnnotations,
sinon.match.array.deepEquals([fixtures.ann.$tag])
);
frameSync.hoverAnnotation(null);
assert.calledWith(fakeStore.hoverAnnotations, []);
});
it('focuses the associated highlights in the guest', () => {
......
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