Add New chat to compact sidebar
Expose the existing chat creation flow from the compact rail so users can start chats without expanding the session list. Add focused callback coverage and document the verified behavior.
This commit is contained in:
@@ -85,6 +85,7 @@ void main() {
|
||||
activeSessionId: null,
|
||||
visibleSessionIds: const {'a'},
|
||||
onOpen: (_) {},
|
||||
onNewChat: () {},
|
||||
onExpand: () {},
|
||||
navigation: const Text('Destinations'),
|
||||
),
|
||||
@@ -139,6 +140,7 @@ void main() {
|
||||
activeSessionId: 'a',
|
||||
visibleSessionIds: const {'a', 'b'},
|
||||
onOpen: (_) {},
|
||||
onNewChat: () {},
|
||||
onExpand: () {},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -107,6 +107,7 @@ void main() {
|
||||
await controller.refresh();
|
||||
final folds = ChatSectionFolds();
|
||||
addTearDown(folds.dispose);
|
||||
var newChatPressed = false;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
@@ -116,12 +117,16 @@ void main() {
|
||||
activeSessionId: 'a',
|
||||
visibleSessionIds: const {'a', 'b'},
|
||||
onOpen: (_) {},
|
||||
onNewChat: () => newChatPressed = true,
|
||||
onExpand: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byTooltip('New chat'), findsOneWidget);
|
||||
await tester.tap(find.byTooltip('New chat'));
|
||||
expect(newChatPressed, isTrue);
|
||||
expect(find.byTooltip('Expand chat list'), findsOneWidget);
|
||||
expect(edge(tester, 'a').width, 10);
|
||||
expect(edge(tester, 'b').width, 3);
|
||||
|
||||
Reference in New Issue
Block a user