fix: open the Move to list from a message window's menu again, with the list's new emails prop (the test's mock follows the prop rename)

This commit is contained in:
Linus Rath
2026-11-04 07:02:48 +01:00
parent 277e1aa55d
commit 111a505078
2 changed files with 5 additions and 5 deletions
@@ -33,9 +33,9 @@ vi.mock('@/lib/popout/window-role', async (importOriginal) => ({
...await importOriginal<typeof import('@/lib/popout/window-role')>(),
isPopoutWindow: () => popout.value,
}));
const moveDialog = vi.hoisted(() => ({ current: null as { email: unknown } | null }));
const moveDialog = vi.hoisted(() => ({ current: null as { emails: unknown[] } | null }));
vi.mock('@/components/email/move-to-dialog', () => ({
MoveToDialog: (props: { email: unknown }) => {
MoveToDialog: (props: { emails: unknown[] }) => {
moveDialog.current = props;
return null;
},
@@ -331,11 +331,11 @@ describe('Message > Move to… in a message window', () => {
const client = { getEmail: vi.fn().mockResolvedValue(DRAFT), getUsername: () => 'userb@example.org', getAccountId: () => 'e' };
render(<ProEmailView emailId="eaaaaab" client={client as never} onClose={vi.fn()} />);
await waitFor(() => expect(viewerProps.current?.email).toBeTruthy());
expect(moveDialog.current?.email ?? null).toBeNull();
expect(moveDialog.current?.emails ?? []).toEqual([]);
act(() => {
expect(runDesktopCommand('message.move')).toBe(true);
});
await waitFor(() => expect(moveDialog.current?.email).toMatchObject({ id: 'eaaaaab' }));
await waitFor(() => expect(moveDialog.current?.emails?.[0]).toMatchObject({ id: 'eaaaaab' }));
} finally {
popout.value = false;
window.bulwarkDesktop = undefined;
+1 -1
View File
@@ -649,7 +649,7 @@ export function ProEmailView({ emailId, client: clientOverride, clientAccountId,
<ConfirmDialog {...confirmDialogProps} />
{inOwnWindow && (
<MoveToDialog
email={moveDialogOpen ? email : null}
emails={moveDialogOpen && email ? [email] : []}
mailboxes={mailboxes}
selectedMailbox=""
onClose={() => setMoveDialogOpen(false)}