- TaskActions AsyncNotifier for create, update, delete, complete task mutations - tasksInRoomProvider manual StreamProvider.family wrapping TasksDao.watchTasksInRoom - TaskFormScreen with name, frequency (10 presets + custom), effort (3-way segmented), description, and initial due date picker (German DD.MM.YYYY format) - Custom frequency: number + unit picker (Tage/Wochen/Monate) - Calendar-anchored intervals auto-set anchorDay from due date - Edit mode loads existing task and pre-fills all fields - 19 new German localization keys for task form, delete, and empty state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
2.6 KiB
Dart
74 lines
2.6 KiB
Dart
// ignore_for_file: scoped_providers_should_specify_dependencies
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:household_keeper/core/router/router.dart';
|
|
import 'package:household_keeper/features/rooms/presentation/room_providers.dart';
|
|
import 'package:household_keeper/l10n/app_localizations.dart';
|
|
|
|
void main() {
|
|
group('AppShell Navigation', () {
|
|
setUp(() {
|
|
SharedPreferences.setMockInitialValues({});
|
|
});
|
|
|
|
/// Helper to build the app with room provider overridden to empty list.
|
|
Widget buildApp() {
|
|
return ProviderScope(
|
|
overrides: [
|
|
// Override the stream provider to return an empty list immediately
|
|
// so that the rooms screen shows the empty state without needing a DB.
|
|
roomWithStatsListProvider.overrideWith(
|
|
(ref) => Stream.value([]),
|
|
),
|
|
],
|
|
child: MaterialApp.router(
|
|
routerConfig: router,
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: const [Locale('de')],
|
|
locale: const Locale('de'),
|
|
),
|
|
);
|
|
}
|
|
|
|
testWidgets('renders 3 navigation destinations with correct German labels',
|
|
(tester) async {
|
|
await tester.pumpWidget(buildApp());
|
|
await tester.pumpAndSettle();
|
|
|
|
// Verify 3 NavigationDestination widgets are rendered
|
|
expect(find.byType(NavigationDestination), findsNWidgets(3));
|
|
|
|
// Verify correct German labels from ARB (with umlauts)
|
|
expect(find.text('\u00dcbersicht'), findsOneWidget);
|
|
expect(find.text('R\u00e4ume'), findsOneWidget);
|
|
expect(find.text('Einstellungen'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('tapping a destination changes the selected tab',
|
|
(tester) async {
|
|
await tester.pumpWidget(buildApp());
|
|
await tester.pumpAndSettle();
|
|
|
|
// Initially on Home tab (index 0) -- verify home empty state is shown
|
|
expect(find.text('Noch nichts zu tun!'), findsOneWidget);
|
|
|
|
// Tap the Rooms tab (second destination)
|
|
await tester.tap(find.text('R\u00e4ume'));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Verify we see Rooms content now (empty state)
|
|
expect(find.text('Hier ist noch alles leer!'), findsOneWidget);
|
|
|
|
// Tap the Settings tab (third destination)
|
|
await tester.tap(find.text('Einstellungen'));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Verify we see Settings content now
|
|
expect(find.text('Darstellung'), findsOneWidget);
|
|
});
|
|
});
|
|
}
|