Hide phone navigation on run details
Keep pushed run detail and placeholder views consistent with the phone navigation behavior by hiding the shell bar. Add regression coverage and preserve the floating-bar motion test at its intended breakpoint.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
|
||||
/// A pushed run detail covers the phone's bottom navigation bar, both once the
|
||||
/// run has loaded and while its placeholder (loading or failed) shows.
|
||||
void main() {
|
||||
Future<void> pumpPhoneRunDetail(
|
||||
WidgetTester tester, {
|
||||
required bool loaded,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final gateway = RunDetailFakeGateway(graphRunFixture());
|
||||
final controller = RunsController(RunsRepository(gateway));
|
||||
addTearDown(controller.dispose);
|
||||
if (loaded) await controller.select(51);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destination: AppDestination.runs,
|
||||
destinationBodies: {
|
||||
AppDestination.runs: (_) => RunDetailView(
|
||||
controller: controller,
|
||||
gateway: gateway,
|
||||
onBack: () {},
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
testWidgets('a loaded run detail hides the phone navigation bar', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpPhoneRunDetail(tester, loaded: true);
|
||||
|
||||
expect(find.byType(RunDetailView), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('the run detail placeholder hides the phone navigation bar', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpPhoneRunDetail(tester, loaded: false);
|
||||
|
||||
expect(find.byType(RunDetailView), findsOneWidget);
|
||||
expect(find.text('Run details unavailable.'), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('the runs list keeps the phone navigation bar', (tester) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destination: AppDestination.runs,
|
||||
destinationBodies: {
|
||||
AppDestination.runs: (_) => const Text('runs list'),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user