Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): cover the promptFromOpen Escape-cascade branch and the baseline close case

[._.]/ Adam Eivyddc52d6df4b5
diff --git a/client/src/components/media/MediaLightbox.test.jsx b/client/src/components/media/MediaLightbox.test.jsx
index b58cecfd1b..3f0a792fb2 100644
--- a/client/src/components/media/MediaLightbox.test.jsx
+++ b/client/src/components/media/MediaLightbox.test.jsx
@@ -10,7 +10,10 @@ vi.mock('./AddToCollectionMenu', () => ({ default: () => null }));
vi.mock('./PromptRefineModal', () => ({
default: ({ open }) => open ? <div data-testid="refine-modal" /> : null,
}));
-vi.mock('./PromptFromMedia', () => ({ default: () => null, PromptFromMediaModal: () => null }));
+vi.mock('./PromptFromMedia', () => ({
+ default: () => null,
+ PromptFromMediaModal: ({ open }) => open ? <div data-testid="prompt-from-modal" /> : null,
+}));
const videoItem = {
kind: 'video',
@@ -143,6 +146,29 @@ describe('MediaLightbox Escape cascade', () => {
expect(screen.queryByTestId('refine-modal')).toBeNull();
expect(screen.getByRole('dialog')).toBeTruthy();
});
+
+ it('closes the prompt-from-media modal without closing the lightbox', () => {
+ const onClose = vi.fn();
+ render(<MediaLightbox item={imageItem} onClose={onClose} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Prompt from this' }));
+ const promptFromModal = screen.getByTestId('prompt-from-modal');
+
+ fireEvent.keyDown(promptFromModal, { key: 'Escape' });
+
+ expect(onClose).not.toHaveBeenCalled();
+ expect(screen.queryByTestId('prompt-from-modal')).toBeNull();
+ expect(screen.getByRole('dialog')).toBeTruthy();
+ });
+
+ it('closes the lightbox when Escape is pressed with nothing else open', () => {
+ const onClose = vi.fn();
+ render(<MediaLightbox item={imageItem} onClose={onClose} />);
+
+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' });
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
});
describe('MediaLightbox route-changing actions', () => {