tane/apps/app_seeds/test/ui/legal_screen_test.dart
vjrj 15385a26cf feat: cover seedlings (plantón) in copy + legal, backup cadence, server picker
Beta-tester feedback triage. The data model already had LotType.seedling as
first class; the gaps were copy and UX.

- Seedlings/plantones: broaden landing hero (EN/ES), in-app legal notice, and
  all legal texts (site + docs masters) from seeds-only to "seeds and
  seedlings", with a live-plant phytosanitary/transport caveat. Seeds stay the
  hero — targeted, not a blanket rename.
- Backups: settings line now states the 7-day cadence explicitly; cadence lives
  in AutoBackupService.backupInterval as the single source for text and schedule.
- Community servers: replace the manual wss:// text box with a checklist of the
  known servers (defaults visible/toggleable) plus an "add server" affordance
  with basic validation. No jargon in the UI.

i18n across en/es/pt/fr/de/ast (ja falls back). Tests updated + a new
server-picker widget test.
2026-07-15 15:57:23 +02:00

53 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/i18n/strings.g.dart';
import 'package:tane/ui/legal_screen.dart';
void main() {
Widget app() => TranslationProvider(
child: const MaterialApp(
localizationsDelegates: GlobalMaterialLocalizations.delegates,
home: LegalScreen(),
),
);
testWidgets('shows the three summaries with their full-text links', (
tester,
) async {
LocaleSettings.setLocaleSync(AppLocale.en);
await tester.pumpWidget(app());
await tester.pump();
expect(find.text('Your privacy'), findsOneWidget);
// No account, no tracker, plain-words copy is on screen.
expect(find.textContaining('without an account'), findsOneWidget);
expect(find.text('Read the full documents online'), findsWidgets);
// The later sections start below the fold of the test viewport.
await tester.scrollUntilVisible(
find.text('About sharing seeds and seedlings'),
300,
);
expect(find.text('Rules of the road'), findsOneWidget);
expect(find.text('About sharing seeds and seedlings'), findsOneWidget);
});
testWidgets('renders under RTL without overflowing', (tester) async {
LocaleSettings.setLocaleSync(AppLocale.en);
await tester.pumpWidget(
TranslationProvider(
child: const MaterialApp(
localizationsDelegates: GlobalMaterialLocalizations.delegates,
home: Directionality(
textDirection: TextDirection.rtl,
child: LegalScreen(),
),
),
),
);
await tester.pump();
expect(tester.takeException(), isNull);
expect(find.byType(LegalScreen), findsOneWidget);
});
}