mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-02 16:07:12 +00:00
fix: name the calendar description field plainly instead of the desktop help text
This commit is contained in:
@@ -307,9 +307,11 @@ export function CalendarEditSheet({ visible, calendar, onSave, onClose }: Calend
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
<Text style={styles.label}>{t('calendar.management.description', 'Description')}</Text>
|
||||
{/* Not calendar.management.description: in the webmail's
|
||||
catalog that is the management page's desktop help text. */}
|
||||
<Text style={styles.label}>{t('calendar.management.description_field', 'Description')}</Text>
|
||||
<TextInput
|
||||
accessibilityLabel={t('calendar.management.description', 'Description')}
|
||||
accessibilityLabel={t('calendar.management.description_field', 'Description')}
|
||||
value={description}
|
||||
onChangeText={setDescription}
|
||||
placeholder={t('calendar.management.description_placeholder', 'Optional')}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const root = path.resolve(__dirname, '../../../..');
|
||||
const source = fs.readFileSync(path.resolve(__dirname, '../CalendarEditSheet.tsx'), 'utf8');
|
||||
const catalog = (file: string) => JSON.parse(fs.readFileSync(path.join(root, file), 'utf8'));
|
||||
const common = catalog('locales/en/common.json');
|
||||
const overlay = catalog('locales/rn/en.json');
|
||||
|
||||
function lookup(tree: Record<string, unknown>, key: string): unknown {
|
||||
return key.split('.').reduce<unknown>((node, part) => (node as Record<string, unknown> | undefined)?.[part], tree);
|
||||
}
|
||||
|
||||
// The app reads the overlay over the webmail's catalog.
|
||||
const english = (key: string) => (lookup(overlay, key) ?? lookup(common, key)) as string | undefined;
|
||||
|
||||
describe('the calendar sheet’s description field', () => {
|
||||
it('is named "Description", not by the webmail’s desktop help text', () => {
|
||||
const before = source.slice(0, source.indexOf('value={description}'));
|
||||
const input = before.slice(before.lastIndexOf('<TextInput'));
|
||||
const key = input.match(/accessibilityLabel=\{t\('([^']+)'/)?.[1];
|
||||
expect(key).toBeTruthy();
|
||||
expect(english(key!)).toBe('Description');
|
||||
|
||||
const labels = [...before.matchAll(/<Text style=\{styles\.label\}>\{t\('([^']+)'/g)];
|
||||
expect(english(labels[labels.length - 1][1])).toBe('Description');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user