Files
ZenXercise/test/views/home_view_test.dart
T
CedricandClaude Opus 5.5 786dd52e30 Stage 2: Library search, filters and Exercise detail with Flip Animation
- LibraryFilter: word search on names; muscle (primary), equipment and
  level choices that widen within a filter and narrow across filters
- ExerciseBrowser (reusable for the Plan picker) with search field,
  filter sheets showing live result counts, a clear button and an
  empty state
- Exercise detail: start/end Flip Animation at each Mode's pace (still
  with reduced motion), facts, main/secondary muscles, numbered steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:33:07 +01:00

45 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:zenxercise/src/design/zen_style.dart';
import 'package:zenxercise/src/home/home_view.dart';
import 'package:zenxercise/src/modes/mode.dart';
import '../support/test_app.dart';
void main() {
ZenStyle styleOf(WidgetTester tester) => ZenStyle.of(tester.element(find.byType(HomeView)));
testWidgets('switching Mode changes design and Library together', (tester) async {
final settings = await pumpApp(tester);
await tester.tap(find.byTooltip('Library'));
await tester.pumpAndSettle();
expect(styleOf(tester).mode, Mode.stretching);
expect(find.text('2 stretches'), findsOneWidget);
expect(find.text('90/90 Hamstring'), findsOneWidget);
await tester.tap(find.text('Workout'));
await tester.pumpAndSettle();
expect(settings.mode, Mode.workout);
expect(styleOf(tester).mode, Mode.workout);
expect(styleOf(tester).brightness, Brightness.dark);
expect(find.text('1 exercise'), findsOneWidget);
expect(find.text('Barbell Squat'), findsOneWidget);
expect(find.text('90/90 Hamstring'), findsNothing);
});
testWidgets('opens in the last-used Mode', (tester) async {
await pumpApp(tester, prefs: {'mode': 'workout'});
expect(styleOf(tester).mode, Mode.workout);
});
testWidgets('an empty Plans tab invites building a Plan from the library', (tester) async {
await pumpApp(tester);
expect(find.text('No plans yet'), findsOneWidget);
expect(find.textContaining('stretch routine'), findsOneWidget);
});
}