Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(desktop): retain lightbox click and fitted-size behavior

MagicLizi5a3b0226d31b
diff --git a/apps/desktop/src/renderer/components/chat/__tests__/ImageLightboxAnnotate.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/ImageLightboxAnnotate.test.tsx
index f62ffda753..0ec252ce9d 100644
--- a/apps/desktop/src/renderer/components/chat/__tests__/ImageLightboxAnnotate.test.tsx
+++ b/apps/desktop/src/renderer/components/chat/__tests__/ImageLightboxAnnotate.test.tsx
@@ -95,6 +95,29 @@ afterEach(() => {
});
describe('ImageLightbox annotate mode', () => {
+ // Normal viewing must leave image clicks available for double-click zoom,
+ // while background clicks close exactly once after the exit animation.
+ it('keeps image clicks open and closes once for repeated background clicks', () => {
+ vi.useFakeTimers();
+ const onClose = vi.fn();
+ render(<ImageLightbox src={SRC} onClose={onClose} />);
+ const image = lightboxImage();
+ loadImage(image);
+ // viewBox-only SVGs also need an explicit fitted box after natural-size load.
+ expect(image.style.width).toBe('200px');
+ expect(image.style.height).toBe('100px');
+ act(() => vi.advanceTimersByTime(200));
+ const overlay = document.activeElement!;
+ expect(overlay.contains(image)).toBe(true);
+ fireEvent.click(image);
+ act(() => vi.advanceTimersByTime(250));
+ expect(onClose).not.toHaveBeenCalled();
+ fireEvent.click(overlay);
+ fireEvent.click(overlay);
+ act(() => vi.advanceTimersByTime(250));
+ expect(onClose).toHaveBeenCalledExactlyOnceWith();
+ });
+
// Replaces the deleted source scan: a background misclick during annotation
// must preserve unsaved strokes (engineering-conventions §3.2, user data).
it('keeps unsaved strokes and the lightbox open after a background click', () => {