diff --git a/test/features/home/presentation/home_screen_test.dart b/test/features/home/presentation/home_screen_test.dart index 0df2025..858611e 100644 --- a/test/features/home/presentation/home_screen_test.dart +++ b/test/features/home/presentation/home_screen_test.dart @@ -10,6 +10,8 @@ import 'package:household_keeper/features/home/presentation/calendar_providers.d import 'package:household_keeper/features/rooms/presentation/room_providers.dart'; import 'package:household_keeper/features/tasks/domain/effort_level.dart'; import 'package:household_keeper/features/tasks/domain/frequency.dart'; +import 'package:household_keeper/features/tasks/domain/task_sort_option.dart'; +import 'package:household_keeper/features/tasks/presentation/sort_preference_notifier.dart'; import 'package:household_keeper/l10n/app_localizations.dart'; import 'package:household_keeper/features/home/domain/daily_plan_models.dart'; @@ -65,6 +67,7 @@ Widget _buildApp(CalendarDayState dayState) { roomWithStatsListProvider.overrideWith( (ref) => Stream.value([]), ), + sortPreferenceProvider.overrideWith(SortPreferenceNotifier.new), ]); return UncontrolledProviderScope( @@ -238,4 +241,38 @@ void main() { expect(find.byType(ListView), findsWidgets); }); }); + + group('HomeScreen sort dropdown', () { + testWidgets('shows sort dropdown in AppBar', (tester) async { + await tester.pumpWidget(_buildApp(CalendarDayState( + selectedDate: today, + dayTasks: const [], + overdueTasks: const [], + totalTaskCount: 0, + ))); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 500)); + + // SortDropdown wraps a PopupMenuButton + expect( + find.byType(PopupMenuButton), + findsOneWidget, + ); + }); + + testWidgets('shows AppBar with title', (tester) async { + await tester.pumpWidget(_buildApp(CalendarDayState( + selectedDate: today, + dayTasks: const [], + overdueTasks: const [], + totalTaskCount: 0, + ))); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 500)); + + // tabHome l10n string is 'Übersicht'. It appears in the AppBar title + // and also in the bottom navigation bar label — use findsWidgets. + expect(find.text('\u00dcbersicht'), findsWidgets); + }); + }); } diff --git a/test/shell/app_shell_test.dart b/test/shell/app_shell_test.dart index ddebf3f..0ea3460 100644 --- a/test/shell/app_shell_test.dart +++ b/test/shell/app_shell_test.dart @@ -63,8 +63,9 @@ void main() { // 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); + // Verify correct German labels from ARB (with umlauts). + // 'Übersicht' appears in both the bottom nav and the HomeScreen AppBar. + expect(find.text('\u00dcbersicht'), findsWidgets); expect(find.text('R\u00e4ume'), findsOneWidget); expect(find.text('Einstellungen'), findsOneWidget); });