feat(app): artifact viewer previews the text family (logs, JSON, code, config) in bundled monospace
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_preview.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_url.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_content.dart';
|
||||
import 'package:pipelines_app/ui/text/monospace.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('a text-family preview is selectable bundled monospace', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ArtifactPreviewBody(
|
||||
plan: ArtifactPreviewPlan(
|
||||
kind: ArtifactPreviewKind.text,
|
||||
resolved: ResolvedArtifactUrl(
|
||||
uri: Uri.parse('http://127.0.0.1:8080/artifacts/1/main.py'),
|
||||
external: false,
|
||||
),
|
||||
message: '',
|
||||
),
|
||||
loading: false,
|
||||
markdownBuilder: defaultArtifactMarkdown,
|
||||
text: 'def main():\n return 0\n',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final text = tester.widget<SelectableText>(
|
||||
find.byKey(const Key('artifact-text-preview')),
|
||||
);
|
||||
expect(text.data, 'def main():\n return 0\n');
|
||||
expect(text.style?.fontFamily, appMonospaceFamily);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user