Keep chat controls readable and expose labeled app navigation
This commit is contained in:
@@ -41,7 +41,7 @@ Widget _app(_Gateway gateway, {int sync = 0}) => MaterialApp(
|
||||
body: ChatScreen(gateway: gateway, syncToken: sync),
|
||||
),
|
||||
);
|
||||
Future<_Gateway> _setup(WidgetTester tester) async {
|
||||
Future<_Gateway> _setup(WidgetTester tester, {bool inShell = false}) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = const Size(1800, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
@@ -60,7 +60,21 @@ Future<_Gateway> _setup(WidgetTester tester) async {
|
||||
]);
|
||||
};
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(_app(gateway));
|
||||
await tester.pumpWidget(
|
||||
inShell
|
||||
? MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
cupertino: false,
|
||||
destination: AppDestination.chat,
|
||||
destinationBodies: {
|
||||
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
|
||||
AppDestination.runs: (_) =>
|
||||
const Center(child: Text('Runs destination')),
|
||||
},
|
||||
),
|
||||
)
|
||||
: _app(gateway),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Chat a').first);
|
||||
await tester.pumpAndSettle();
|
||||
@@ -79,6 +93,35 @@ Future<void> _split(WidgetTester tester, String id, String action) async {
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'compact navigation reaches Runs and returns without losing draft',
|
||||
(tester) async {
|
||||
await _setup(tester, inShell: true);
|
||||
final state = tester.state(_thread('a'));
|
||||
await tester.enterText(_input('a'), 'Keep compact draft');
|
||||
await tester.drag(
|
||||
find.byKey(const ValueKey('list-detail-divider')),
|
||||
const Offset(-500, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Menu'), findsOneWidget);
|
||||
await tester.tap(find.text('Menu'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Runs'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Runs destination'), findsOneWidget);
|
||||
await tester.tap(find.byTooltip('Chat'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Menu'), findsOneWidget);
|
||||
expect(tester.state(_thread('a')), same(state));
|
||||
expect(
|
||||
tester.widget<EditableText>(_input('a')).controller.text,
|
||||
'Keep compact draft',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('phone peeks fit a small keyboard viewport at large text', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user