feat(app): previous/next for visits, artifacts and diffs are chevrons in one row at the bottom right

This commit is contained in:
2026-10-23 17:14:44 +01:00
parent 73d59f4d85
commit 3fc7a28e76
9 changed files with 204 additions and 225 deletions
@@ -42,7 +42,7 @@ void main() {
// The aggregate counts each path once across both visits, and does not
// change as the operator pages.
expect(find.text('3 files changed'), findsOneWidget);
expect(find.text('1 of 2 recorded visits'), findsOneWidget);
expect(find.text('1 of 2'), findsOneWidget);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/a.dart'), findsOneWidget);
@@ -57,7 +57,7 @@ void main() {
expect(find.text('lib/c.dart'), findsOneWidget);
expect(find.text('lib/a.dart'), findsNothing);
expect(find.text('3 files changed'), findsOneWidget);
expect(find.text('2 of 2 recorded visits'), findsOneWidget);
expect(find.text('2 of 2'), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.previousKey));
await tester.pump();
@@ -65,17 +65,33 @@ void main() {
expect(find.text('implementer'), findsOneWidget);
expect(find.text('lib/a.dart'), findsOneWidget);
expect(find.text('lib/c.dart'), findsNothing);
expect(find.text('1 of 2 recorded visits'), findsOneWidget);
expect(find.text('1 of 2'), findsOneWidget);
},
);
testWidgets('visit chevrons share one row at the bottom right', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(materialHost(ChangesViewer(steps: twoVisitRun())));
final previous = tester.getRect(find.byKey(ChangesVisitPager.previousKey));
final next = tester.getRect(find.byKey(ChangesVisitPager.nextKey));
expect(previous.center.dy, moreOrLessEquals(next.center.dy));
expect(previous.right, lessThanOrEqualTo(next.left));
expect(next.right, greaterThan(390 - 32));
expect(next.bottom, greaterThan(844 - 80));
});
testWidgets('paging stops at both ends instead of wrapping', (tester) async {
await tester.pumpWidget(materialHost(ChangesViewer(steps: twoVisitRun())));
TextButton previous() =>
tester.widget<TextButton>(find.byKey(ChangesVisitPager.previousKey));
TextButton next() =>
tester.widget<TextButton>(find.byKey(ChangesVisitPager.nextKey));
IconButton previous() =>
tester.widget<IconButton>(find.byKey(ChangesVisitPager.previousKey));
IconButton next() =>
tester.widget<IconButton>(find.byKey(ChangesVisitPager.nextKey));
expect(previous().onPressed, isNull);
expect(next().onPressed, isNotNull);
@@ -110,9 +126,12 @@ void main() {
),
),
);
expect(find.text('Previous visit'), findsNothing);
expect(find.text('Next visit'), findsNothing);
expect(find.textContaining('recorded visits'), findsNothing);
expect(find.byKey(ChangesVisitPager.previousKey), findsNothing);
expect(find.byKey(ChangesVisitPager.nextKey), findsNothing);
expect(
find.byKey(const ValueKey<String>('changes-visit-position')),
findsNothing,
);
// The single visit still keeps its identity heading.
expect(find.text('implementer'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
@@ -162,7 +181,7 @@ void main() {
expect(tester.takeException(), isNull);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('Previous visit'), findsNothing);
expect(find.byKey(ChangesVisitPager.previousKey), findsNothing);
});
testWidgets('the pager stays reachable at 320x720 with 2x text', (
@@ -178,14 +197,14 @@ void main() {
),
);
expect(tester.takeException(), isNull);
expect(find.text('Previous visit'), findsOneWidget);
expect(find.text('Next visit'), findsOneWidget);
expect(find.byKey(ChangesVisitPager.previousKey), findsOneWidget);
expect(find.byKey(ChangesVisitPager.nextKey), findsOneWidget);
// At 2x text the fixed summary and filter leave a short scroll viewport;
// the pager is still reachable by scrolling the visit body.
await tester.ensureVisible(find.text('Next visit'));
await tester.ensureVisible(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
await tester.tap(find.text('Next visit'));
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(tester.takeException(), isNull);
expect(find.text('reviewer'), findsOneWidget);
@@ -206,8 +225,8 @@ void main() {
);
expect(previous.onPressed, isNull);
expect(next.onPressed, isNotNull);
expect(find.text('Previous visit'), findsOneWidget);
expect(find.text('Next visit'), findsOneWidget);
expect(find.byKey(ChangesVisitPager.previousKey), findsOneWidget);
expect(find.byKey(ChangesVisitPager.nextKey), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();