9e4a925587
Render one transcriptRows row with native controls: role-labelled user and agent messages, verbatim user text, client and attachment names (own name, URI basename, else file), ordered agent parts, and collapsed reasoning, tool and unknown-part bodies using ExpansionTile or a Cupertino disclosure. Blank known parts draw nothing so they no longer fall through to the unknown-part disclosure; closed bodies build lazily. Adds focused widget tests, the fixture probe pair and the C2 evidence note.
65 lines
1.7 KiB
Dart
65 lines
1.7 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/chat/ui/transcript/native_disclosure.dart';
|
|
|
|
Widget _material(WidgetBuilder body) => MaterialApp(
|
|
theme: ThemeData(brightness: Brightness.dark),
|
|
home: Scaffold(
|
|
body: NativeDisclosure(label: 'Body', childBuilder: body),
|
|
),
|
|
);
|
|
|
|
Widget _cupertino(WidgetBuilder body) => CupertinoApp(
|
|
theme: const CupertinoThemeData(brightness: Brightness.dark),
|
|
home: CupertinoPageScaffold(
|
|
child: NativeDisclosure(label: 'Body', childBuilder: body),
|
|
),
|
|
);
|
|
|
|
void main() {
|
|
testWidgets('closed Material disclosure never builds its body', (
|
|
tester,
|
|
) async {
|
|
var builds = 0;
|
|
await tester.pumpWidget(
|
|
_material((context) {
|
|
builds++;
|
|
return const Text('body');
|
|
}),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(builds, 0);
|
|
expect(find.text('body'), findsNothing);
|
|
|
|
await tester.tap(find.text('Body'));
|
|
await tester.pumpAndSettle();
|
|
expect(builds, greaterThan(0));
|
|
expect(find.text('body'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('closed Cupertino disclosure never builds its body', (
|
|
tester,
|
|
) async {
|
|
var builds = 0;
|
|
await tester.pumpWidget(
|
|
_cupertino((context) {
|
|
builds++;
|
|
return const Text('body');
|
|
}),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(builds, 0);
|
|
expect(find.text('body'), findsNothing);
|
|
|
|
await tester.tap(find.text('Body'));
|
|
await tester.pumpAndSettle();
|
|
expect(builds, 1);
|
|
expect(find.text('body'), findsOneWidget);
|
|
|
|
await tester.tap(find.text('Body'));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('body'), findsNothing);
|
|
});
|
|
}
|