From b17d4d40699ce1de23cf442fe497c8352eff1c90 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 31 Oct 2026 13:49:05 +0100 Subject: [PATCH] fix: say in Composing that "Plain text only" also shows received mail as plain text --- .../__tests__/plain-text-description.test.ts | 26 +++++++++++++++++++ src/components/settings/ComposingSettings.tsx | 5 +++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/components/__tests__/plain-text-description.test.ts diff --git a/src/components/__tests__/plain-text-description.test.ts b/src/components/__tests__/plain-text-description.test.ts new file mode 100644 index 00000000..d4375091 --- /dev/null +++ b/src/components/__tests__/plain-text-description.test.ts @@ -0,0 +1,26 @@ +// "Plain text only" also makes the app show received mail as plain text +// (plain-text-reading.test.ts), but Settings > Composing described it with +// the webmail's text, which only talks about sending. +import { describe, expect, it, vi } from 'vitest'; +import fs from 'node:fs'; +import path from 'node:path'; + +vi.mock('expo-localization', () => ({ getLocales: () => [] })); + +import { translate } from '../../i18n'; + +function description(rel: string): string { + const source = fs.readFileSync(path.resolve(__dirname, '..', rel), 'utf8'); + const m = /t\('(settings\.email_behavior\.plain_text_mode\.[a-z_]+)', (['"])(.*?)\2\)/.exec( + source.slice(source.indexOf("plain_text_mode.label")), + ); + if (!m) throw new Error(`no plain_text_mode description in ${rel}`); + return translate('en', m[1], m[3]); +} + +describe('the plain text only setting', () => { + it('mentions reading in Composing as well as in Reading', () => { + expect(description('settings/ComposingSettings.tsx')).toMatch(/\bread\b/i); + expect(description('settings/ReadingSettings.tsx')).toMatch(/\bread\b/i); + }); +}); diff --git a/src/components/settings/ComposingSettings.tsx b/src/components/settings/ComposingSettings.tsx index abd83843..33471199 100644 --- a/src/components/settings/ComposingSettings.tsx +++ b/src/components/settings/ComposingSettings.tsx @@ -133,7 +133,10 @@ export function ComposingSettings() { updateSetting('plainTextMode', v)} />