Merge commit '551e403d48d51e4904387d2c299dcfd9ec62dbf9' into pipelines/run-20261111-1951-material-cleanup-shared-ui-primitives-65fb

This commit is contained in:
2026-11-11 20:56:34 +00:00
37 changed files with 626 additions and 150 deletions
@@ -35,7 +35,6 @@ void main() {
onOpen: (_) {},
now: () => attentionNow,
notifications: notify,
cupertino: false,
),
),
);
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_bell.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
import 'needs_you_test_support.dart';
@@ -106,32 +104,4 @@ void main() {
expect(find.byKey(attentionSheetKey), findsNothing);
expect(bellHasFocus(tester), isTrue);
});
testWidgets('a stale cupertino flag still draws the Material bell and sheet', (
tester,
) async {
await tester.pumpWidget(
attentionApp(
Scaffold(
body: Center(
child: NeedsYouBell(
entries: [attentionFixture()],
cupertino: true,
onOpen: (_) {},
onDismiss: (_) {},
onClearAll: (_) {},
),
),
),
),
);
expect(tester.widget(find.byKey(attentionBellKey)), isA<IconButton>());
expect(find.byIcon(Icons.notifications_outlined), findsOneWidget);
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
expect(find.byKey(attentionSheetKey), findsOneWidget);
});
}
@@ -1,4 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/domain/attention_models.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
@@ -7,6 +7,29 @@ import 'package:pipelines_app/ui/status/run_status_icon.dart';
import 'needs_you_test_support.dart';
void main() {
testWidgets('Needs you uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
final entry = attentionFixture(id: 1, title: 'Ship the release');
tester.view.physicalSize = const Size(800, 1400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(attentionApp(NeedsYouPage(entries: [entry])));
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
Navigator.of(tester.element(find.byKey(attentionSheetKey))).pop();
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('Material sheet names every row and every dismiss action', (
tester,
) async {
@@ -5,6 +5,8 @@ import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/features/chat/ui/sessions/session_actions.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
import 'package:pipelines_app/features/search/search_screen.dart';
import 'package:pipelines_app/features/search/ui/search_bar_controls.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -51,6 +53,11 @@ Future<void> _setup(WidgetTester tester) async {
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
AppDestination.search: (_) => SearchScreen(
gateway: gateway,
onOpen: (_) {},
embedded: true,
),
},
),
),
@@ -104,8 +111,8 @@ void main() {
expect(await _slash(tester), isFalse);
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isTrue);
// Shift+/ (a question mark) and Alt+/ are not the shortcut; Ctrl+/ is
// the shell's own Search chord.
// Shift+/ (a question mark) is not the shortcut. Alt+/ opens the Search
// destination, while Ctrl+/ remains the shell's own Search chord.
await _focusSidebar(tester);
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.slash, character: '?');
@@ -114,7 +121,11 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.slash);
await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
await tester.pumpAndSettle();
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isFalse);
expect(find.byKey(searchFieldKey), findsOneWidget);
expect(
tester.widget<TextField>(find.byKey(searchFieldKey)).focusNode!.hasFocus,
isTrue,
);
await tester.pumpWidget(const SizedBox.shrink());
});
@@ -155,6 +155,45 @@ void main() {
});
});
testWidgets('colour uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
final gateway = _gateway();
tester.view.physicalSize = const Size(800, 1400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await _pump(tester, gateway, brightness: Brightness.light);
await tester.tap(
find.descendant(
of: find.byKey(const Key('chat-actions-s2')),
matching: find.byType(IconButton),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Colour…'));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
Navigator.of(
tester.element(find.byKey(const Key('chat-color-sheet'))),
).pop();
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(
find.descendant(
of: find.byKey(const Key('chat-actions-s2')),
matching: find.byType(IconButton),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Colour…'));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('the selected coloured row keeps its colour and selection', (
tester,
) async {
@@ -96,6 +96,23 @@ void main() {
expect(find.textContaining('Last 7 days'), findsOneWidget);
});
testWidgets('filter uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
await mount(tester);
await tester.tap(find.byKey(const ValueKey('runs.filter')));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
await tester.tap(find.byKey(runsFilterDoneKey));
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(find.byKey(const ValueKey('runs.filter')));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('Material single-choice groups are check rows, not checkboxes', (
tester,
) async {
@@ -136,10 +153,7 @@ void main() {
testWidgets('the usage page is honest when nothing was reported', (
tester,
) async {
await mount(
tester,
createdAt: DateTime(2020, 1, 1).toIso8601String(),
);
await mount(tester, createdAt: DateTime(2020, 1, 1).toIso8601String());
await tester.tap(find.byKey(const ValueKey('runs.stats')));
await tester.pumpAndSettle();
@@ -0,0 +1,92 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/settings/keyboard_shortcuts_help.dart';
import 'package:pipelines_app/features/settings/keyboard_shortcuts_registry.dart';
void main() {
const registry = KeyboardShortcutRegistry(
platform: TargetPlatform.macOS,
web: true,
);
test('registry uses platform labels and browser caveats', () {
final entries = registry.entries;
final terminal = entries.firstWhere(
(entry) => entry.action == 'Show or hide terminal',
);
final search = entries.firstWhere((entry) => entry.action == 'Open Search');
expect(terminal.keys, contains('Option+T'));
expect(terminal.keys, isNot(contains('Cmd+T')));
expect(search.keys, 'Option+/, Cmd+/, Ctrl+/');
expect(search.caveat, contains('browser'));
});
test('uses the shell primary modifier rule on iOS', () {
final entries = const KeyboardShortcutRegistry(
platform: TargetPlatform.iOS,
web: false,
).entries;
expect(
entries
.firstWhere((entry) => entry.action == 'Open a chat list item')
.keys,
'Ctrl+1…9',
);
expect(
entries.firstWhere((entry) => entry.action == 'Open Search').keys,
'Option+/, Ctrl+/',
);
expect(
entries
.firstWhere((entry) => entry.action == 'Show or hide floating chats')
.caveat,
contains('focuses its message input'),
);
});
testWidgets('help is readable and keyboard traversable', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: KeyboardShortcutsHelp(registry: registry),
),
),
),
);
expect(find.text('Keyboard shortcuts'), findsOneWidget);
expect(find.text('Show or hide floating chats'), findsOneWidget);
expect(find.text('Option+Y, Ctrl+Y, Cmd+Y'), findsOneWidget);
expect(
tester.getSemantics(find.bySemanticsLabel('Keyboard shortcuts help')),
matchesSemantics(
scopesRoute: true,
namesRoute: true,
label: 'Keyboard shortcuts help',
),
);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
expect(find.byTooltip('Close keyboard shortcuts'), findsOneWidget);
});
testWidgets('narrow help content scrolls', (tester) async {
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(400, 640),
textScaler: TextScaler.linear(2),
),
child: MaterialApp(
home: Scaffold(body: KeyboardShortcutsHelp(registry: registry)),
),
),
);
expect(find.byType(SingleChildScrollView), findsOneWidget);
expect(find.text('Keyboard shortcuts'), findsOneWidget);
});
}
+32
View File
@@ -75,6 +75,27 @@ void main() {
});
}
test('Alt+/ uses the physical slash key for Option dead-key delivery', () {
const event = KeyDownEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
character: '¿',
timeStamp: Duration.zero,
);
expect(shellSearchShortcut(event, _AltHeld()), isTrue);
expect(
shellSearchShortcut(
const KeyUpEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
timeStamp: Duration.zero,
),
_AltHeld(),
),
isFalse,
);
});
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
testWidgets(
'Search chord opens and refocuses retained query on $platform',
@@ -130,3 +151,14 @@ void main() {
);
}
}
class _AltHeld extends HardwareKeyboard {
@override
bool get isAltPressed => true;
@override
bool get isControlPressed => false;
@override
bool get isMetaPressed => false;
@override
bool get isShiftPressed => false;
}