Anchor desktop Files and Runs menus
Use Material popup menus for file actions and anchor Runs sorting choices to the sort button while retaining the phone fallback. Update callers, tests, and implementation notes to match the desktop behavior.
This commit is contained in:
@@ -7,7 +7,6 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_filter_sheet.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_filters.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_list.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_sheet_header.dart';
|
||||
|
||||
@@ -139,44 +138,14 @@ void main() {
|
||||
expect(tester.widget<ListTile>(anyTime).selected, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('Material sort sheet has the same header', (tester) async {
|
||||
testWidgets('Material sort opens an anchored choice menu', (tester) async {
|
||||
await mount(tester, cupertino: false);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runsSortTitle), findsOneWidget);
|
||||
await tester.tap(find.byKey(runsSortDoneKey));
|
||||
expect(find.byKey(const ValueKey('app-choice-menu')), findsOneWidget);
|
||||
await tester.tap(find.text('Oldest first'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runsSortTitle), findsNothing);
|
||||
expect(controller.sort, 'newest_first');
|
||||
});
|
||||
|
||||
testWidgets('Cupertino sort sheet marks the selected order with an icon', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(tester, cupertino: true);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('✓ Newest first'), findsNothing);
|
||||
final newestFirst = find.widgetWithText(
|
||||
CupertinoActionSheetAction,
|
||||
'Newest first',
|
||||
);
|
||||
expect(newestFirst, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: newestFirst,
|
||||
matching: find.byIcon(CupertinoIcons.checkmark),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final selected = find.descendant(
|
||||
of: newestFirst,
|
||||
matching: find.byWidgetPredicate(
|
||||
(widget) => widget is Semantics && widget.properties.selected == true,
|
||||
),
|
||||
);
|
||||
expect(selected, findsOneWidget);
|
||||
expect(controller.sort, 'oldest_first');
|
||||
});
|
||||
|
||||
testWidgets('the usage page is honest when nothing was reported', (
|
||||
|
||||
@@ -121,25 +121,18 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(taps, 1);
|
||||
|
||||
// One overflow icon per host; the menu items keep their keys.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('menu')),
|
||||
matching: find.byIcon(
|
||||
cupertino ? CupertinoIcons.ellipsis : Icons.more_vert,
|
||||
),
|
||||
),
|
||||
// The overflow control is the same Material menu on every host.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('menu')),
|
||||
matching: find.byIcon(Icons.more_vert),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
await tester.tap(find.byKey(const Key('menu')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(taps, 1, reason: 'the menu is its own control');
|
||||
if (cupertino) {
|
||||
expect(find.byType(CupertinoActionSheet), findsOneWidget);
|
||||
expect(find.text('Cancel'), findsOneWidget);
|
||||
} else {
|
||||
expect(find.byType(PopupMenuItem<String>), findsNWidgets(2));
|
||||
}
|
||||
expect(find.byType(PopupMenuItem<String>), findsNWidgets(2));
|
||||
await tester.tap(find.byKey(const Key('menu-delete')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(picked, 'delete');
|
||||
|
||||
Reference in New Issue
Block a user