feat(app): pipeline source and stage prompts switch between raw and rendered markdown
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart';
|
||||
import 'package:pipelines_app/ui/text/markdown_source_view.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('markdown starts raw and switches to rendered and back', (
|
||||
tester,
|
||||
) async {
|
||||
const source = '# stage Plan\n\nDraft the **plan**.';
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MarkdownSourceView(
|
||||
text: source,
|
||||
raw: SelectableText(source, key: Key('raw')),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.byKey(const Key('raw')), findsOneWidget);
|
||||
expect(find.byType(ChatMarkdownView), findsNothing);
|
||||
|
||||
await tester.tap(find.text('Rendered'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ChatMarkdownView), findsOneWidget);
|
||||
expect(find.byKey(const Key('raw')), findsNothing);
|
||||
|
||||
await tester.tap(find.text('Raw'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('raw')), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user