Merge commit 'bd256ad1'

This commit is contained in:
2026-10-25 21:55:55 +00:00
6 changed files with 154 additions and 132 deletions
@@ -107,20 +107,21 @@ void main() {
});
test('meta and status come only from the row', () {
expect(
chatSessionMeta({'directory': '/work', 'model': 'model-a'}),
'opencode · model-a · /work',
);
expect(chatSessionMeta({'directory': '/work'}), 'opencode · /work');
expect(chatSessionMeta({}), 'opencode');
expect(chatSessionMetaLines({'directory': '/work', 'model': 'model-a'}), [
'opencode',
'model-a',
'/work',
]);
expect(chatSessionMetaLines({'directory': '/work'}), ['opencode', '/work']);
expect(chatSessionMetaLines({}), ['opencode']);
// The agent kind is the row's backend; the home folder reads as ~.
expect(
chatSessionMeta({
chatSessionMetaLines({
'backend': 'claude',
'model': 'opus',
'directory': '/Users/alan/repos/pipelines',
}),
'claude · opus · ~/repos/pipelines',
['claude', 'opus', '~/repos/pipelines'],
);
expect(homeRelativePath('/home/dev/x'), '~/x');
expect(homeRelativePath('/Users/alan'), '~');
@@ -169,24 +170,26 @@ void main() {
// As on the web: the unread word trails the title; the muted meta line
// leads with the recency.
expect(find.text('Starred chat'), findsOneWidget);
expect(find.text('5 min ago · opencode · model-a · /work'), findsOneWidget);
expect(find.text('5 min ago'), findsOneWidget);
expect(find.text('model-a'), findsOneWidget);
expect(find.text('New'), findsOneWidget);
expect(find.text('2 hr ago · opencode · /work'), findsOneWidget);
expect(find.text('2 hr ago'), findsOneWidget);
expect(find.text('opencode'), findsNWidgets(2));
expect(find.text('/work'), findsNWidgets(2));
expect(
(tester.getCenter(find.text('Starred chat')).dy -
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(4),
tester.getCenter(find.text('New')).dy,
greaterThan(tester.getCenter(find.text('Starred chat')).dy),
);
expect(
tester.getCenter(find.text('5 min ago')).dx,
greaterThan(tester.getCenter(find.text('Starred chat')).dx),
);
// The meta line keeps `CupertinoListTile`'s native 12pt subtitle style; it
// must not be rendered at the title's body size. The colour-only style the
// row passes merges with the tile's own `DefaultTextStyle`.
final titleStyle = _styleOf(tester, 'Starred chat');
final metaStyle = _styleOf(
tester,
'5 min ago · opencode · model-a · /work',
);
final metaStyle = _styleOf(tester, '5 min ago');
expect(metaStyle.fontSize, lessThan(titleStyle.fontSize!));
expect(metaStyle.fontSize, 12.0);
expect(_styleOf(tester, 'New').fontSize, titleStyle.fontSize);
@@ -229,16 +232,19 @@ void main() {
expect(tester.takeException(), isNull);
const title = 'A conversation title long enough to need an ellipsis';
const meta =
'3 days ago · opencode · provider/an-extremely-long-recorded-model-id'
' · /a/very/long/directory/that/must/ellipsise';
const meta = '/a/very/long/directory/that/must/ellipsise';
final titleParagraph = tester.renderObject<RenderParagraph>(
find.text(title),
);
expect(titleParagraph.maxLines, 1);
expect(titleParagraph.maxLines, 2);
expect(titleParagraph.didExceedMaxLines, isTrue);
final metaParagraph = tester.renderObject<RenderParagraph>(find.text(meta));
expect(metaParagraph.maxLines, 1);
final metaParagraph = tester.renderObject<RenderParagraph>(
find.descendant(
of: find.byKey(const Key('chat-row-s1')),
matching: find.text(meta),
),
);
expect(metaParagraph.maxLines, 2);
expect(metaParagraph.didExceedMaxLines, isTrue);
// The state word is the row's only unread marker: at the smallest supported
@@ -259,12 +265,9 @@ void main() {
);
}
// The word shares the title's line, as on the web.
expect(
(tester.getCenter(find.text(title)).dy -
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(20),
tester.getCenter(find.text('New')).dy,
greaterThan(tester.getCenter(find.text(title)).dy),
);
});
}
@@ -74,24 +74,24 @@ void main() {
], isUnseen: (session) => session['id'] == 's1');
expect(find.text('Starred chat'), findsOneWidget);
expect(find.text('5 min ago · opencode · model-a · /work'), findsOneWidget);
expect(find.text('5 min ago'), findsOneWidget);
expect(find.text('opencode'), findsNWidgets(2));
expect(find.text('model-a'), findsOneWidget);
expect(find.text('/work'), findsNWidgets(2));
expect(find.text('New'), findsOneWidget);
expect(find.text('2 hr ago · opencode · /work'), findsOneWidget);
// As on the web, the unread word shares the title's line.
expect(find.text('2 hr ago'), findsOneWidget);
expect(
(tester.getCenter(find.text('Starred chat')).dy -
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(4),
tester.getCenter(find.text('New')).dy,
greaterThan(tester.getCenter(find.text('Starred chat')).dy),
);
expect(
tester.getCenter(find.text('5 min ago')).dx,
greaterThan(tester.getCenter(find.text('Starred chat')).dx),
);
// The meta line is the theme's muted colour, not the title colour.
final meta = tester.widget<Text>(
find.text('5 min ago · opencode · model-a · /work'),
);
final context = tester.element(
find.text('5 min ago · opencode · model-a · /work'),
);
final meta = tester.widget<Text>(find.text('5 min ago'));
final context = tester.element(find.text('5 min ago'));
expect(meta.style?.color, Theme.of(context).colorScheme.onSurfaceVariant);
// Native Material separators sit between rows, not around the group.
@@ -155,16 +155,19 @@ void main() {
expect(tester.takeException(), isNull);
const title = 'A conversation title long enough to need an ellipsis';
const meta =
'3 days ago · opencode · provider/an-extremely-long-recorded-model-id'
' · /a/very/long/directory/that/must/ellipsise';
const meta = '/a/very/long/directory/that/must/ellipsise';
final titleParagraph = tester.renderObject<RenderParagraph>(
find.text(title),
);
expect(titleParagraph.maxLines, 1);
expect(titleParagraph.maxLines, 2);
expect(titleParagraph.didExceedMaxLines, isTrue);
final metaParagraph = tester.renderObject<RenderParagraph>(find.text(meta));
expect(metaParagraph.maxLines, 1);
final metaParagraph = tester.renderObject<RenderParagraph>(
find.descendant(
of: find.byKey(const Key('chat-row-s1')),
matching: find.text(meta),
),
);
expect(metaParagraph.maxLines, 2);
expect(metaParagraph.didExceedMaxLines, isTrue);
// `New`/`Closed` is the row's only unread marker; it stays whole at the
@@ -184,9 +187,16 @@ void main() {
);
}
// Two lines: the title/word line, then the muted recency/meta line.
// The title/state and every metadata field occupy distinct lines.
expect(
tester.getCenter(find.text(meta)).dy,
tester
.getCenter(
find.descendant(
of: find.byKey(const Key('chat-row-s1')),
matching: find.text(meta).last,
),
)
.dy,
greaterThan(tester.getCenter(find.text(title)).dy),
);
});