A pasted-image @<path> token now renders as an inline, keyboard-activatable thumbnail in the Claude conversation that opens the full image in the lightbox; the composer's attachment chips use the same (larger, 44px) thumbnail. New ImageThumbnail + openImageLightbox in the Claude layer; ClideMarkdown gains an onImageToken builder seam (mirroring onRecordTap) that drops a WidgetSpan into the text flow — it owns no Image.file/lightbox, staying generic. Missing files degrade to a placeholder; render-only (the sent text + copyText are unchanged). Resolves the conflicting T-236 (inline thumbnail) / T-254 (image card) designs into the hybrid the user chose; recorded as D-89. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
Dart
43 lines
1.5 KiB
Dart
/// Tests for ImageThumbnail (T-236 / T-254): a bounded, keyboard-activatable
|
|
/// image preview that opens the lightbox and degrades gracefully.
|
|
library;
|
|
|
|
import 'package:clide/builtin/claude/src/image_thumbnail.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import '../../helpers/kernel_fixture.dart';
|
|
import '../../helpers/widget_harness.dart';
|
|
|
|
void main() {
|
|
group('ImageThumbnail', () {
|
|
late KernelFixture f;
|
|
setUp(() async => f = await KernelFixture.create());
|
|
tearDown(() => f.dispose());
|
|
|
|
testWidgets('carries an a11y label from the file name', (tester) async {
|
|
await tester.pumpWidget(harness(f, const ImageThumbnail(path: '/tmp/clide/paste-9.png')));
|
|
await tester.pump();
|
|
expect(find.bySemanticsLabel('Image paste-9.png'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('a missing file degrades to a placeholder without throwing', (tester) async {
|
|
await tester.pumpWidget(harness(f, const ImageThumbnail(path: '/no/such/file.png')));
|
|
await tester.pumpAndSettle();
|
|
expect(find.byType(ImageThumbnail), findsOneWidget);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('tapping opens the lightbox via the dialog router', (tester) async {
|
|
await tester.pumpWidget(harness(f, const ImageThumbnail(path: '/no/such/file.png')));
|
|
await tester.pump();
|
|
expect(f.services.dialog.isOpen, isFalse);
|
|
|
|
await tester.tap(find.byType(ImageThumbnail));
|
|
await tester.pump();
|
|
|
|
expect(f.services.dialog.isOpen, isTrue);
|
|
});
|
|
});
|
|
}
|