130c1e6708
Chat stack is now the default phone chat navigation (a stored choice is kept), and on Android or iOS it stays on a wide layout (an unfolded foldable) above the active pane, where floating is ignored too. When expanded, the pile turns into a close button at its own spot and the column rises above it; while a chat is dragged that button is the remove target, replacing the separate x at the bottom. Chat widget tests start on Quick switch (they run as Android); the stack's tests choose it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.1 KiB
Dart
66 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/chat/stack/mobile_chat_navigation.dart';
|
|
import 'package:pipelines_app/features/settings/settings_chat_navigation_section.dart';
|
|
|
|
class _Store implements MobileChatNavigationStore {
|
|
String? saved;
|
|
bool success = true;
|
|
@override
|
|
Future<String?> load() async => saved;
|
|
@override
|
|
Future<bool> save(String value) async {
|
|
saved = value;
|
|
return success;
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('chooses, saves and restores the phone chat navigation', (
|
|
tester,
|
|
) async {
|
|
final store = _Store();
|
|
final controller = MobileChatNavigationController(store: store);
|
|
addTearDown(controller.dispose);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: SettingsChatNavigationSection(controller: controller),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text(SettingsChatNavigationSection.title), findsOneWidget);
|
|
// Without a stored choice: the Chat stack.
|
|
expect(controller.value, MobileChatNavigation.chatStack);
|
|
expect(
|
|
find.text(MobileChatNavigation.chatStack.description),
|
|
findsOneWidget,
|
|
);
|
|
await tester.tap(
|
|
find.byKey(const ValueKey('settings-chat-navigation-quickSwitch')),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(controller.value, MobileChatNavigation.quickSwitch);
|
|
expect(store.saved, 'quickSwitch');
|
|
expect(
|
|
find.text(MobileChatNavigation.quickSwitch.description),
|
|
findsOneWidget,
|
|
);
|
|
|
|
// A new controller (the next launch) restores the saved choice.
|
|
final next = MobileChatNavigationController(store: store);
|
|
addTearDown(next.dispose);
|
|
await next.restore();
|
|
expect(next.value, MobileChatNavigation.quickSwitch);
|
|
|
|
store.success = false;
|
|
await tester.tap(
|
|
find.byKey(const ValueKey('settings-chat-navigation-chatStack')),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('Could not save; applies until reload.'), findsOneWidget);
|
|
});
|
|
}
|