Commit b7e3b350 authored by Robert Knight's avatar Robert Knight

Fix incorrect use of removeSelectedAnnotation()

This function expects an ID, not an Annotation
parent 28f81290
......@@ -153,7 +153,9 @@ function RootThread($rootScope, annotationUI, drafts, features, searchFilter, vi
// Remove any annotations that are deleted or unloaded
$rootScope.$on(events.ANNOTATION_DELETED, function (event, annotation) {
annotationUI.removeAnnotations([annotation]);
annotationUI.removeSelectedAnnotation(annotation);
if (annotation.id) {
annotationUI.removeSelectedAnnotation(annotation.id);
}
});
$rootScope.$on(events.ANNOTATIONS_UNLOADED, function (event, annotations) {
annotationUI.removeAnnotations(annotations);
......
......@@ -344,7 +344,7 @@ describe('rootThread', function () {
it('deselects deleted annotations', function () {
$rootScope.$broadcast(events.ANNOTATION_DELETED, annot);
assert.calledWith(fakeAnnotationUI.removeSelectedAnnotation, annot);
assert.calledWith(fakeAnnotationUI.removeSelectedAnnotation, annot.id);
});
describe('when a new annotation is created', function () {
......
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