Quieter transcript metadata: day dividers, time-only rows, muted meta rows
- Date once per calendar day: a muted centred divider above each day's
first timed row (chatDayDividers); rows show only their time ("10:16"),
with the full date and time kept in the tooltip and semantics. The user's
time shares the delivery line; a harness notice's time trails its line.
- Activity line and turn chips are secondary: bodyMedium, regular weight,
onSurfaceVariant (error colour kept for failures), a small chevron_right
that turns down while its details are open (replaces expand_less).
- Copy / Read aloud: 18 px muted icons; on pointer devices shown only while
the reply is hovered or an action is focused (also without the gutter);
touch keeps them visible with a full tap target. The time leads the
footer so hidden actions leave no gap.
- Settled questions: the question on one line, the operator's answer in
full on its own line beneath it.
- Meta rows (activity, chips, notices, compaction line) start at the reply
text's leading edge; turn chips sit in their own column under the answer.
- Scroll fixture: ?timestamps=1 spreads messages over two days.
Row keys are unchanged; the divider joins a row without replacing it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_timestamp.dart';
|
||||
|
||||
import '../shell/chat_shell_fixtures.dart';
|
||||
|
||||
JsonMap _message(String id, String role, DateTime at) => {
|
||||
'id': id,
|
||||
'role': role,
|
||||
'created_at': at.millisecondsSinceEpoch,
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'Text of $id'},
|
||||
],
|
||||
};
|
||||
|
||||
void main() {
|
||||
testWidgets('the transcript dates each day once and each row by its time', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(900, 2400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final gateway = ShellGateway()
|
||||
..messages = [
|
||||
_message('u1', 'user', DateTime(2026, 11, 24, 9, 5)),
|
||||
_message('a1', 'assistant', DateTime(2026, 11, 24, 9, 6)),
|
||||
_message('u2', 'user', DateTime(2026, 11, 24, 17, 40)),
|
||||
_message('a2', 'assistant', DateTime(2026, 11, 24, 17, 41)),
|
||||
_message('u3', 'user', DateTime(2026, 11, 25, 10, 16)),
|
||||
_message('a3', 'assistant', DateTime(2026, 11, 25, 10, 17)),
|
||||
];
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final dividers = find.byType(ChatDayDivider);
|
||||
expect(dividers, findsNWidgets(2));
|
||||
expect(find.text('24 November 2026'), findsOneWidget);
|
||||
expect(find.text('25 November 2026'), findsOneWidget);
|
||||
// The first day's divider precedes its first message; the second day's
|
||||
// sits between the last message of the 24th and the first of the 25th.
|
||||
final first = tester.getRect(find.text('24 November 2026'));
|
||||
final second = tester.getRect(find.text('25 November 2026'));
|
||||
expect(first.bottom, lessThan(tester.getRect(find.text('Text of u1')).top));
|
||||
expect(
|
||||
second.top,
|
||||
greaterThan(tester.getRect(find.text('Text of a2')).top),
|
||||
);
|
||||
expect(
|
||||
second.bottom,
|
||||
lessThan(tester.getRect(find.text('Text of u3')).top),
|
||||
);
|
||||
|
||||
// Every row shows its time alone; no row repeats the date.
|
||||
expect(find.byType(ChatMessageTimestamp), findsNWidgets(6));
|
||||
for (final time in ['09:05', '09:06', '17:40', '17:41', '10:16', '10:17']) {
|
||||
expect(find.text(time), findsOneWidget);
|
||||
}
|
||||
expect(find.textContaining('November 2026 ·'), findsNothing);
|
||||
// The divider names its day for assistive technology as a heading.
|
||||
expect(
|
||||
tester.getSemantics(dividers.first),
|
||||
isSemantics(label: '24 November 2026', isHeader: true),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
|
||||
import '../shell/chat_shell_fixtures.dart';
|
||||
|
||||
const _reply = 'The reply text';
|
||||
|
||||
final List<JsonMap> _messages = [
|
||||
{
|
||||
'id': 'u1',
|
||||
'role': 'user',
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'Question'},
|
||||
],
|
||||
},
|
||||
{
|
||||
'id': 'a1',
|
||||
'role': 'assistant',
|
||||
'parts': [
|
||||
{'type': 'reasoning', 'text': 'Thinking it over.'},
|
||||
{
|
||||
'type': 'tool',
|
||||
'id': 't1',
|
||||
'name': 'read',
|
||||
'state': 'completed',
|
||||
'input': {'path': 'lib/main.dart'},
|
||||
},
|
||||
{'type': 'text', 'text': _reply},
|
||||
],
|
||||
},
|
||||
{
|
||||
'id': 'n1',
|
||||
'role': 'user',
|
||||
'kind': 'notice',
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'The harness compacted the context.'},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
void main() {
|
||||
for (final width in [390.0, 1400.0]) {
|
||||
testWidgets('at ${width.toInt()} px every meta row starts at the reply '
|
||||
'text\'s edge', (tester) async {
|
||||
tester.view.physicalSize = Size(width, 1200);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final gateway = ShellGateway()..messages = _messages;
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final text = tester.getRect(find.text(_reply)).left;
|
||||
// The activity line's label.
|
||||
final activity = find.descendant(
|
||||
of: find.byKey(const Key('chat-turn-activity')),
|
||||
matching: find.byType(Text),
|
||||
);
|
||||
expect(tester.getRect(activity.first).left, text);
|
||||
// The harness notice's icon.
|
||||
expect(tester.getRect(find.byIcon(Icons.info_outline)).left, text);
|
||||
|
||||
// The activity label is secondary: smaller than the reply, regular
|
||||
// weight, in the muted colour.
|
||||
final label = tester.widget<Text>(activity.first);
|
||||
final context = tester.element(activity.first);
|
||||
final theme = Theme.of(context);
|
||||
expect(label.style?.color, theme.colorScheme.onSurfaceVariant);
|
||||
expect(label.style?.fontWeight, FontWeight.w400);
|
||||
expect(
|
||||
label.style?.fontSize,
|
||||
lessThan(theme.textTheme.bodyLarge!.fontSize!),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,9 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
// The answered question leaves the card list (chat_question_group_test).
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Colour · Red · +1 more'), findsOneWidget);
|
||||
// Collapsed: the question on one line, the answer in full on its own.
|
||||
expect(find.text('Colour'), findsOneWidget);
|
||||
expect(find.text('Red · +1 more'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a refused question keeps the card open with the server reason', (
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_question_group.dart';
|
||||
|
||||
const _answer =
|
||||
'Postgres 16 on the managed cluster, with read replicas in both regions '
|
||||
'and nightly backups kept for thirty days';
|
||||
|
||||
JsonMap _form() => {
|
||||
'id': 'form-1',
|
||||
'title': 'Database',
|
||||
'resolved': true,
|
||||
'answers': {'q0': _answer},
|
||||
'fields': [
|
||||
{
|
||||
'key': 'q0',
|
||||
'title': 'Which database should the release use?',
|
||||
'type': 'string',
|
||||
'custom': true,
|
||||
'options': [
|
||||
{'value': 'Postgres', 'label': 'Postgres'},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
final _chip = find.byKey(const ValueKey('chat-question-chip-form-1'));
|
||||
final _answerLine = find.byKey(const ValueKey('chat-question-answer-form-1'));
|
||||
|
||||
Future<void> _pump(WidgetTester tester) async {
|
||||
await tester.binding.setSurfaceSize(const Size(390, 844));
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
child: ChatQuestionChip(form: _form()),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('the summary splits into the question and its outcome', () {
|
||||
final parts = chatQuestionSummaryParts(_form());
|
||||
expect(parts.question, 'Which database should the release use?');
|
||||
expect(parts.outcome, _answer);
|
||||
expect(
|
||||
chatQuestionSummary(_form()),
|
||||
'Which database should the release use? · $_answer',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('a settled question shows its whole answer on its own line', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester);
|
||||
final question = find.text('Which database should the release use?');
|
||||
expect(question, findsOneWidget);
|
||||
expect(find.text(_answer), findsOneWidget);
|
||||
// The answer wraps in full rather than ellipsizing on the question's line.
|
||||
final answer = tester.widget<Text>(_answerLine);
|
||||
expect(answer.maxLines, isNull);
|
||||
expect(answer.overflow, isNot(TextOverflow.ellipsis));
|
||||
final line = tester.getRect(question);
|
||||
final rect = tester.getRect(_answerLine);
|
||||
expect(rect.top, greaterThanOrEqualTo(line.bottom));
|
||||
expect(rect.height, greaterThan(line.height * 1.5));
|
||||
// Both lines start together, after the leading icon.
|
||||
expect(rect.left, line.left);
|
||||
// It is emphasised above the muted question.
|
||||
final context = tester.element(_answerLine);
|
||||
expect(answer.style?.color, Theme.of(context).colorScheme.onSurface);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('its chevron is the expand affordance and turns while open', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester);
|
||||
expect(find.byIcon(Icons.expand_less), findsNothing);
|
||||
expect(
|
||||
find.descendant(of: _chip, matching: find.byIcon(Icons.chevron_right)),
|
||||
findsOneWidget,
|
||||
);
|
||||
double turns() => tester
|
||||
.widget<AnimatedRotation>(
|
||||
find.descendant(of: _chip, matching: find.byType(AnimatedRotation)),
|
||||
)
|
||||
.turns;
|
||||
expect(turns(), 0);
|
||||
await tester.tap(_chip);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-question-sheet')), findsOneWidget);
|
||||
expect(turns(), 0.25);
|
||||
Navigator.of(
|
||||
tester.element(find.byKey(const Key('chat-question-sheet'))),
|
||||
).pop();
|
||||
await tester.pumpAndSettle();
|
||||
expect(turns(), 0);
|
||||
});
|
||||
}
|
||||
@@ -55,6 +55,13 @@ JsonMap _form({String id = 'form-1'}) => {
|
||||
|
||||
const _chip = 'Which database? · Postgres';
|
||||
|
||||
/// One line of the settled question's chip: the question, or the recorded
|
||||
/// outcome on its own line beneath it.
|
||||
Finder _settledLine(String text) => find.descendant(
|
||||
of: find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
matching: find.text(text),
|
||||
);
|
||||
|
||||
/// A chat whose agent turn `a1` is the one the question arrives during.
|
||||
Future<FakeChatGateway> _open(WidgetTester tester, Size size) async {
|
||||
await tester.binding.setSurfaceSize(size);
|
||||
@@ -97,12 +104,13 @@ void _expectCollapsed() {
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text(chatQuestionSubmit), findsNothing);
|
||||
expect(find.text(chatQuestionAnswered), findsNothing);
|
||||
expect(find.text(_chip), findsOneWidget);
|
||||
// The chip sits in its turn's footer, under the turn that asked.
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Postgres'), findsOneWidget);
|
||||
// The chip sits among its turn's chips, under the turn that asked.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.text(_chip),
|
||||
of: find.byKey(const Key('chat-turn-chips')),
|
||||
matching: find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
@@ -194,12 +202,15 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
_expectCollapsed();
|
||||
|
||||
await tester.tap(find.text(_chip));
|
||||
await tester.tap(find.byKey(const ValueKey('chat-question-chip-form-1')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-question-sheet')), findsOneWidget);
|
||||
expect(find.text('Which database?'), findsOneWidget);
|
||||
expect(find.text('Postgres'), findsOneWidget);
|
||||
expect(find.text(chatQuestionAnswered), findsOneWidget);
|
||||
final sheet = find.byKey(const Key('chat-question-sheet'));
|
||||
expect(sheet, findsOneWidget);
|
||||
Finder inSheet(String text) =>
|
||||
find.descendant(of: sheet, matching: find.text(text));
|
||||
expect(inSheet('Which database?'), findsOneWidget);
|
||||
expect(inSheet('Postgres'), findsOneWidget);
|
||||
expect(inSheet(chatQuestionAnswered), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -213,7 +224,10 @@ void main() {
|
||||
expect(find.textContaining('no longer awaiting'), findsOneWidget);
|
||||
expect(find.text(chatQuestionWaiting), findsOneWidget);
|
||||
expect(find.text(chatQuestionSubmit), findsOneWidget);
|
||||
expect(find.text(_chip), findsNothing);
|
||||
expect(
|
||||
find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -227,7 +241,8 @@ void main() {
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Which database? · Closed'), findsOneWidget);
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Closed'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a cancelled question collapses as expired', (tester) async {
|
||||
@@ -239,7 +254,8 @@ void main() {
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Which database? · Expired'), findsOneWidget);
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Expired'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('OpenCode: ack then form.replied leaves one collapsed row', (
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/domain/chat_transcript_days.dart';
|
||||
|
||||
int _at(int day, int hour) =>
|
||||
DateTime(2026, 11, day, hour).millisecondsSinceEpoch;
|
||||
|
||||
JsonMap _user(int? time) => {
|
||||
'kind': 'user',
|
||||
'message': {'created_at': ?time},
|
||||
};
|
||||
|
||||
JsonMap _turn(int? time) => {'kind': 'assistant', 'created_at': ?time};
|
||||
|
||||
void main() {
|
||||
test('a row takes its own, its message\'s or its first notice\'s time', () {
|
||||
expect(chatRowCreatedAt(_turn(_at(24, 9))), _at(24, 9));
|
||||
expect(chatRowCreatedAt(_user(_at(24, 10))), _at(24, 10));
|
||||
expect(
|
||||
chatRowCreatedAt({
|
||||
'kind': 'task_notices',
|
||||
'messages': [
|
||||
{'created_at': 'bad'},
|
||||
{'created_at': _at(25, 8)},
|
||||
],
|
||||
}),
|
||||
_at(25, 8),
|
||||
);
|
||||
expect(chatRowCreatedAt({'kind': 'question', 'form': {}}), isNull);
|
||||
});
|
||||
|
||||
test('one divider per calendar day, at that day\'s first timed row', () {
|
||||
final rows = [
|
||||
_turn(null), // an untimed row neither starts nor breaks a day
|
||||
_user(_at(24, 9)),
|
||||
_turn(_at(24, 9)),
|
||||
{'kind': 'questions'},
|
||||
_user(_at(24, 23)),
|
||||
_turn(_at(25, 0)),
|
||||
_user(null),
|
||||
_user(_at(25, 10)),
|
||||
_turn(_at(26, 7)),
|
||||
];
|
||||
expect(chatDayDividers(rows), [
|
||||
null,
|
||||
DateTime(2026, 11, 24),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DateTime(2026, 11, 25),
|
||||
null,
|
||||
null,
|
||||
DateTime(2026, 11, 26),
|
||||
]);
|
||||
});
|
||||
|
||||
test('no times, no dividers', () {
|
||||
expect(chatDayDividers([_turn(null), _user(null)]), [null, null]);
|
||||
});
|
||||
}
|
||||
@@ -82,10 +82,10 @@ void main() {
|
||||
expect(card(), findsNothing);
|
||||
expect(chip, findsOneWidget);
|
||||
expect(find.text('2 commands'), findsOneWidget);
|
||||
// The chip is in the second answer's footer, beside its other chips.
|
||||
// The chip is among the second answer's chips, beside its other chips.
|
||||
final footer = find.ancestor(
|
||||
of: chip,
|
||||
matching: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.byKey(const Key('chat-turn-chips')),
|
||||
);
|
||||
expect(footer, findsOneWidget);
|
||||
final message = find.ancestor(
|
||||
@@ -111,7 +111,7 @@ void main() {
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: chip,
|
||||
matching: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.byKey(const Key('chat-turn-chips')),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
|
||||
@@ -28,6 +28,10 @@ void main() {
|
||||
];
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
// Let the transcript settle at its end, so the card (under its day's
|
||||
// date divider) is scrolled clear of the composer before it is tapped.
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
testWidgets(
|
||||
|
||||
@@ -53,10 +53,18 @@ void main() {
|
||||
expect(chatCopyGutter(560), 0);
|
||||
});
|
||||
|
||||
testWidgets('without a gutter Copy starts the footer', (tester) async {
|
||||
testWidgets('without a gutter Copy trails the footer\'s time', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(find.descendant(of: _footer, matching: _copy), findsOneWidget);
|
||||
expect(_gutter, findsNothing);
|
||||
// The time starts at the answer's text edge, so hidden actions never
|
||||
// leave a gap before it.
|
||||
final model = tester.getRect(find.text('gpt-test'));
|
||||
final text = tester.getRect(find.text('The answer text'));
|
||||
expect(model.left, text.left);
|
||||
expect(tester.getRect(_copy).left, greaterThan(model.right));
|
||||
});
|
||||
|
||||
testWidgets('with a gutter Copy sits left of the answer, not in it', (
|
||||
@@ -107,6 +115,63 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
|
||||
);
|
||||
|
||||
double footerOpacity(WidgetTester tester) => tester
|
||||
.widget<AnimatedOpacity>(
|
||||
find.byKey(const Key('chat-message-actions-visibility')),
|
||||
)
|
||||
.opacity;
|
||||
|
||||
testWidgets(
|
||||
'without a gutter a desktop shows the footer actions on hover and focus',
|
||||
(tester) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(footerOpacity(tester), 0);
|
||||
// The time and model stay visible; only the actions wait for hover.
|
||||
expect(find.text('gpt-test'), findsOneWidget);
|
||||
expect(
|
||||
tester.getSemantics(_copy),
|
||||
isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true),
|
||||
);
|
||||
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
addTearDown(mouse.removePointer);
|
||||
await mouse.addPointer(location: Offset.zero);
|
||||
await mouse.moveTo(tester.getCenter(find.text('The answer text')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 1);
|
||||
await mouse.moveTo(const Offset(5, 590));
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 0);
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 1);
|
||||
semantics.dispose();
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
|
||||
);
|
||||
|
||||
testWidgets('touch keeps the footer actions shown, with small muted icons', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(footerOpacity(tester), 1);
|
||||
final context = tester.element(_copy);
|
||||
final icon = tester.getSize(
|
||||
find.descendant(of: _copy, matching: find.byType(Icon)),
|
||||
);
|
||||
// Smaller than the reply's body text line and the default 24 px icon.
|
||||
expect(icon.height, 18);
|
||||
final style = tester.widget<IconButton>(_copy).style!;
|
||||
expect(
|
||||
style.foregroundColor!.resolve({}),
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
// A touch target still meets the platform minimum.
|
||||
expect(tester.getSize(_copy).height, greaterThanOrEqualTo(48));
|
||||
});
|
||||
|
||||
for (final (width, inGutter) in [(1400.0, true), (560.0, false)]) {
|
||||
testWidgets('a ${width.toInt()} px conversation puts Copy '
|
||||
'${inGutter ? 'in the gutter' : 'in the footer'}', (tester) async {
|
||||
|
||||
@@ -82,7 +82,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('shows a local dated timestamp but keeps it out of copy', (
|
||||
testWidgets('shows a local time-only timestamp but keeps it out of copy', (
|
||||
tester,
|
||||
) async {
|
||||
_phone(tester);
|
||||
@@ -122,9 +122,20 @@ void main() {
|
||||
final context = tester.element(find.byType(ChatMessageTimestamp).first);
|
||||
final local = DateTime.utc(2026, 10, 20, 8, 12).toLocal();
|
||||
final l10n = MaterialLocalizations.of(context);
|
||||
final expected =
|
||||
'${local.day} ${l10n.formatMonthYear(local)} · ${l10n.formatTimeOfDay(TimeOfDay.fromDateTime(local), alwaysUse24HourFormat: true)}';
|
||||
expect(find.text(expected), findsOneWidget);
|
||||
final time = l10n.formatTimeOfDay(
|
||||
TimeOfDay.fromDateTime(local),
|
||||
alwaysUse24HourFormat: true,
|
||||
);
|
||||
// The row shows only its time; the date is the day divider's, and the
|
||||
// full date and time stay in the tooltip and the accessible name.
|
||||
final full = '${local.day} ${l10n.formatMonthYear(local)}, $time';
|
||||
expect(find.text(time), findsOneWidget);
|
||||
expect(find.textContaining('2026'), findsNothing);
|
||||
expect(
|
||||
find.byWidgetPredicate((w) => w is Tooltip && w.message == full),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.bySemanticsLabel('Sent $full'), findsOneWidget);
|
||||
|
||||
final copy = tester.widget<ChatCopyButton>(find.byType(ChatCopyButton));
|
||||
expect(copy.text, 'Answer');
|
||||
|
||||
Reference in New Issue
Block a user