diff --git a/src/components/SidebarDrawer.tsx b/src/components/SidebarDrawer.tsx index 7b123aba..66dea0bd 100644 --- a/src/components/SidebarDrawer.tsx +++ b/src/components/SidebarDrawer.tsx @@ -291,6 +291,7 @@ function NamePrompt({ title, message, initial, confirmLabel, onSubmit, onClose } {title} {message ? {message} : null} {total > 4 && ( ') return i; + } + return source.length; +} + +/** `file:line` of every TextInput element without an accessibilityLabel. */ +function unnamedFields(file: string): string[] { + const source = readFileSync(join(SRC, file), 'utf8'); + const out: string[] = []; + // ``. + for (const m of source.matchAll(/ name.endsWith('.tsx')) + .map((name) => `components/compose/${name}`); + +const FILES = [ + 'screens/ComposeScreen.tsx', + 'components/email/QuickReplyBox.tsx', + 'components/SidebarDrawer.tsx', + 'components/TemplateSheet.tsx', + ...COMPOSE, +]; + +describe('field names in mail and the composer', () => { + it('every field has a name', () => { + expect(FILES.flatMap(unnamedFields)).toEqual([]); + }); + + it('finds the composer fields at all', () => { + const source = readFileSync(join(SRC, 'screens/ComposeScreen.tsx'), 'utf8'); + expect([...source.matchAll(/ setPlaceholderPrompt((p) => (p ? { ...p, values: { ...p.values, [name]: v } } : p))} @@ -3392,6 +3397,7 @@ export default function ComposeScreen({ route, navigation }: Props) { <> {t('identities.sub_address.popover_title', 'Add Sub-Address Tag')} {t('email_composer.from_override.toggle_tooltip', 'Edit the From name and address freely. Mail is still sent through your identity - only the visible From header changes.')}