diff --git a/frontend/src/lib/components/AnnotationShape.svelte.spec.ts b/frontend/src/lib/components/AnnotationShape.svelte.spec.ts index f48be08e..87f1cae1 100644 --- a/frontend/src/lib/components/AnnotationShape.svelte.spec.ts +++ b/frontend/src/lib/components/AnnotationShape.svelte.spec.ts @@ -113,6 +113,28 @@ describe('AnnotationShape', () => { expect(onDeleteRequest).toHaveBeenCalledOnce(); }); + it('does not call onclick when delete button is clicked', async () => { + const onclick = vi.fn(); + const onDeleteRequest = vi.fn(); + + render(AnnotationShape, { + annotation: makeAnnotation(), + isHovered: true, + isActive: false, + showDelete: true, + onDeleteRequest, + onclick, + onpointerenter: () => {}, + onpointerleave: () => {} + }); + + const deleteBtn = page.getByTestId('annotation-delete-ann-1'); + await deleteBtn.click(); + + expect(onclick).not.toHaveBeenCalled(); + expect(onDeleteRequest).toHaveBeenCalledOnce(); + }); + it('calls onDeleteRequest when Delete key is pressed on the annotation', async () => { const onDeleteRequest = vi.fn();