feat(chat): ChatGPT-style transcript and composer
Agent replies sit on the page without a bubble and get a copy control; the operator's turn is a neutral rounded bubble; the composer is one filled pill with +, a borderless field and a round Send, and its placeholder names the chat's folder. Also fixes two picker tests left stale by the native picker.
This commit is contained in:
@@ -207,7 +207,10 @@ void main() {
|
||||
testWidgets('the attach control is disabled without a host picker', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpBar(tester);
|
||||
await pumpBar(
|
||||
tester,
|
||||
picker: const ChatAttachmentPicker.unsupported('No picker here.'),
|
||||
);
|
||||
|
||||
final attach = tester.widget<IconButton>(
|
||||
find.byKey(const Key('chat-composer-attach')),
|
||||
|
||||
@@ -76,10 +76,12 @@ Widget composerThread(
|
||||
ChatDraftStore? drafts,
|
||||
String Function()? newOperationId,
|
||||
VoidCallback? onBack,
|
||||
JsonMap? session,
|
||||
}) {
|
||||
final thread = ChatThreadView(
|
||||
gateway: gateway,
|
||||
sessionId: 's',
|
||||
session: session,
|
||||
syncToken: syncToken,
|
||||
onBack: onBack ?? () {},
|
||||
drafts: drafts ?? MemoryChatDraftStore(),
|
||||
|
||||
@@ -30,4 +30,47 @@ void main() {
|
||||
expect(paragraph.overflow, TextOverflow.ellipsis);
|
||||
}
|
||||
});
|
||||
|
||||
test('the placeholder names the chat\'s folder when it has one', () {
|
||||
expect(chatComposerPlaceholderFor('/Users/ada/repos/tank'), 'Work on tank');
|
||||
expect(
|
||||
chatComposerPlaceholderFor('/Users/ada/repos/tank/'),
|
||||
'Work on tank',
|
||||
);
|
||||
expect(chatComposerPlaceholderFor(r'C:\\work\\tank'), 'Work on tank');
|
||||
expect(chatComposerPlaceholderFor(' '), chatComposerPlaceholder);
|
||||
expect(chatComposerPlaceholderFor('/'), chatComposerPlaceholder);
|
||||
});
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('the composer is one pill holding attach, field and Send '
|
||||
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
|
||||
final gateway = ComposerBarGateway();
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(
|
||||
composerThread(
|
||||
gateway,
|
||||
cupertino: cupertino,
|
||||
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final pill = find.byKey(const Key('chat-composer-pill'));
|
||||
for (final key in [
|
||||
'chat-composer-attach',
|
||||
'chat-composer-field',
|
||||
'chat-composer-primary',
|
||||
]) {
|
||||
expect(
|
||||
find.descendant(of: pill, matching: find.byKey(Key(key))),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
expect(
|
||||
find.descendant(of: pill, matching: find.text('Work on tank')),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user