7d2c3412a1
Adds the Paper design and generalises design tokens (transcript, composer, selected-row styles, reading type, panel fill, chat colour saturation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.3 KiB
Dart
69 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/chat/conversation/chat_draft_store.dart';
|
|
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
|
import 'package:pipelines_app/ui/theme/app_design.dart';
|
|
|
|
import 'chat_composer_bar_fixtures.dart';
|
|
|
|
Widget _thread(ComposerBarGateway gateway, AppDesign design) => MaterialApp(
|
|
theme: design.light(),
|
|
home: Scaffold(
|
|
body: ChatThreadView(
|
|
gateway: gateway,
|
|
sessionId: 's',
|
|
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
|
|
syncToken: 0,
|
|
onBack: () {},
|
|
drafts: MemoryChatDraftStore(),
|
|
),
|
|
),
|
|
);
|
|
|
|
void main() {
|
|
testWidgets('Paper: the composer is an underlined writing area, not a '
|
|
'pill, and its rule takes the accent on focus', (tester) async {
|
|
final gateway = ComposerBarGateway();
|
|
addTearDown(gateway.close);
|
|
await tester.pumpWidget(_thread(gateway, AppDesign.paper));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.byKey(const Key('chat-composer-pill')), findsNothing);
|
|
final area = find.byKey(const Key('chat-composer-underline'));
|
|
expect(area, findsOneWidget);
|
|
for (final key in [
|
|
'chat-composer-attach',
|
|
'chat-composer-field',
|
|
'chat-composer-primary',
|
|
]) {
|
|
expect(
|
|
find.descendant(of: area, matching: find.byKey(Key(key))),
|
|
findsOneWidget,
|
|
);
|
|
}
|
|
final scheme = Theme.of(tester.element(area)).colorScheme;
|
|
Color? rule() =>
|
|
(tester
|
|
.widget<AnimatedContainer>(
|
|
find.byKey(const Key('chat-composer-rule')),
|
|
)
|
|
.decoration
|
|
as BoxDecoration?)
|
|
?.color;
|
|
expect(rule(), scheme.outline);
|
|
|
|
await tester.tap(find.byKey(const Key('chat-composer-field')));
|
|
await tester.pumpAndSettle();
|
|
expect(rule(), scheme.primary);
|
|
});
|
|
|
|
testWidgets('Default keeps the pill', (tester) async {
|
|
final gateway = ComposerBarGateway();
|
|
addTearDown(gateway.close);
|
|
await tester.pumpWidget(_thread(gateway, AppDesign.standard));
|
|
await tester.pumpAndSettle();
|
|
expect(find.byKey(const Key('chat-composer-pill')), findsOneWidget);
|
|
expect(find.byKey(const Key('chat-composer-underline')), findsNothing);
|
|
});
|
|
}
|