A pub workspace of the Dart packages Halkyon's apps share: halkyon_ui, Halkyon's look (the theme, fonts, layout and shared widgets, with texts in English and German), halkyon_core's low-level primitives and halkyon_interop's cross-app contracts. Dart 3.13 with LeanCode's lints, configured once at the root; apps take a package by git, pinned to a signed commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
99 lines
2.7 KiB
Dart
99 lines
2.7 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_ui/halkyon_ui.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
import '../support/test_app.dart';
|
|
|
|
void main() {
|
|
/// Shows [child] on a screen, in German.
|
|
Future<void> show(WidgetTester tester, Widget child) => tester.pumpWidget(
|
|
testApp(locale: const Locale('de'), Scaffold(body: child)),
|
|
);
|
|
|
|
testWidgets("a required field says so in the app's language", (
|
|
tester,
|
|
) async {
|
|
await show(
|
|
tester,
|
|
Builder(
|
|
builder: (context) => TextField(
|
|
decoration: requiredDecoration(
|
|
context,
|
|
const InputDecoration(labelText: 'Name'),
|
|
missing: true,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.text('Pflichtfeld'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('a count stepper names its buttons', (tester) async {
|
|
await show(
|
|
tester,
|
|
CountStepper(value: '5', onFewer: () {}, onMore: () {}, onTyped: (_) {}),
|
|
);
|
|
|
|
expect(find.byTooltip('Verringern'), findsOneWidget);
|
|
expect(find.byTooltip('Erhöhen'), findsOneWidget);
|
|
expect(find.byTooltip('Zahl eingeben'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('a reorderable row is dragged by its grip', (tester) async {
|
|
await show(
|
|
tester,
|
|
CustomScrollView(
|
|
slivers: [
|
|
SliverReorderableList(
|
|
itemCount: 1,
|
|
onReorderItem: (_, _) {},
|
|
itemBuilder: (context, index) => ListTile(
|
|
key: const ValueKey('row'),
|
|
title: const Text('Row'),
|
|
trailing: ReorderGrip(index: index),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
expect(find.byTooltip('Zum Umsortieren ziehen'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('More info names itself, and copies a value with a tap', (
|
|
tester,
|
|
) async {
|
|
await show(
|
|
tester,
|
|
Builder(
|
|
builder: (context) => TextButton(
|
|
onPressed: () => showMoreInfoSheet(context, [
|
|
(
|
|
title: null,
|
|
rows: [(label: 'ID', value: '0199a', copyable: true)],
|
|
),
|
|
]),
|
|
child: const Text('Open'),
|
|
),
|
|
),
|
|
);
|
|
await tester.tap(find.text('Open'));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('Weitere Informationen'), findsOneWidget);
|
|
await tester.tap(find.byTooltip('Kopieren'));
|
|
await tester.pump();
|
|
expect(find.text('In die Zwischenablage kopiert'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('the palette picker names its colour', (tester) async {
|
|
await show(
|
|
tester,
|
|
PaletteColorPicker(selected: PaletteColor.copper, onChanged: (_) {}),
|
|
);
|
|
|
|
expect(find.text('Kupfer'), findsOneWidget);
|
|
expect(find.bySemanticsLabel('Farbe: Kupfer'), findsOneWidget);
|
|
});
|
|
}
|