From b312878b3f194ad0b1c3bb67c761848ff86ca61f Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 7 Apr 2026 11:45:23 +0200 Subject: [PATCH] test(ui): add annotation-flash class tests for AnnotationLayer Verifies flashAnnotationId applies and removes the annotation-flash CSS class correctly. Co-Authored-By: Claude Sonnet 4.6 --- .../components/AnnotationLayer.svelte.test.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/frontend/src/lib/components/AnnotationLayer.svelte.test.ts b/frontend/src/lib/components/AnnotationLayer.svelte.test.ts index 81b87a84..1f549cd3 100644 --- a/frontend/src/lib/components/AnnotationLayer.svelte.test.ts +++ b/frontend/src/lib/components/AnnotationLayer.svelte.test.ts @@ -64,4 +64,32 @@ describe('AnnotationLayer', () => { expect(clickedId).toBe('ann-1'); }); }); + + describe('flashAnnotationId prop', () => { + it('should apply annotation-flash class when flashAnnotationId matches', async () => { + render(AnnotationLayer, { + annotations: [annotation], + canDraw: false, + color: '#00c7b1', + flashAnnotationId: 'ann-1', + onDraw: () => {} + }); + + const el = document.querySelector('[data-testid="annotation-ann-1"]')!; + expect(el.classList.contains('annotation-flash')).toBe(true); + }); + + it('should not apply annotation-flash class when flashAnnotationId does not match', async () => { + render(AnnotationLayer, { + annotations: [annotation], + canDraw: false, + color: '#00c7b1', + flashAnnotationId: 'other-id', + onDraw: () => {} + }); + + const el = document.querySelector('[data-testid="annotation-ann-1"]')!; + expect(el.classList.contains('annotation-flash')).toBe(false); + }); + }); });