From 1b24c1980c4e9cf024e0e5f6448938558a9056fc Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:07:06 +0100 Subject: [PATCH] feat: start new messages in the default compose font and size --- .../email/__tests__/composer-a11y.test.tsx | 27 +++++++++++++++++ .../__tests__/rich-text-editor-a11y.test.tsx | 8 +++++ components/email/email-composer.tsx | 10 ++++++- components/email/font-size.ts | 29 +++++++++++++++++++ components/email/rich-text-editor.tsx | 15 ++++++---- 5 files changed, 83 insertions(+), 6 deletions(-) diff --git a/components/email/__tests__/composer-a11y.test.tsx b/components/email/__tests__/composer-a11y.test.tsx index a873bcb22..f662030ca 100644 --- a/components/email/__tests__/composer-a11y.test.tsx +++ b/components/email/__tests__/composer-a11y.test.tsx @@ -444,3 +444,30 @@ describe('confirm before sending (MO-16)', () => { expect(onSend).not.toHaveBeenCalled(); }); }); + +describe('default compose font (CO-16)', () => { + const READY = { ...DRAFT, to: 'bob@example.com' }; + + it('starts the editor in the chosen font and sends it with the mail', async () => { + settings.composeFontFamily = 'serif'; + settings.composeFontSize = '18px'; + const onSend = vi.fn(); + render(); + expect(JSON.parse(screen.getByTestId('rich-text-editor').getAttribute('data-default-style')!)) + .toEqual({ fontFamily: 'serif', fontSize: '18px' }); + + fireEvent.click(screen.getAllByTestId('composer-send')[0]); + await waitFor(() => expect(onSend).toHaveBeenCalledTimes(1)); + const sent = onSend.mock.calls[0][0] as { htmlBody?: string }; + expect(sent.htmlBody).toMatch(/^
/); + }); + + it('leaves the mail as it was without the setting, and ignores values that are not a font', async () => { + settings.composeFontFamily = 'serif">