feat(07-02): add sort dropdown tests to HomeScreen and fix AppShell test regression
- Add sortPreferenceProvider override to _buildApp test helper - Add 'HomeScreen sort dropdown' test group: verifies PopupMenuButton<TaskSortOption> and AppBar title - Fix app_shell_test: expect findsWidgets for 'Übersicht' since AppBar title now also shows it - 115 tests pass total (113 existing + 2 new)
This commit is contained in:
@@ -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<TaskSortOption>
|
||||
expect(
|
||||
find.byType(PopupMenuButton<TaskSortOption>),
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user