feat(legal): in-app Privacy & rules screen with plain-words summaries and links to the full documents
This commit is contained in:
parent
9668e0e70b
commit
a7e10eba7a
5 changed files with 180 additions and 0 deletions
50
apps/app_seeds/test/ui/legal_screen_test.dart
Normal file
50
apps/app_seeds/test/ui/legal_screen_test.dart
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
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'), 300);
|
||||
expect(find.text('Rules of the road'), findsOneWidget);
|
||||
expect(find.text('About sharing seeds'), 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);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue