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>
44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_ui/halkyon_ui.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
void main() {
|
|
Future<TextEditingController> show(WidgetTester tester) async {
|
|
final controller = TextEditingController();
|
|
addTearDown(controller.dispose);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: TextField(
|
|
controller: controller,
|
|
maxLength: TextLimits.name,
|
|
buildCounter: nearLimitCounter,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
return controller;
|
|
}
|
|
|
|
testWidgets('a field counts only near its limit, and stops there', (
|
|
tester,
|
|
) async {
|
|
final controller = await show(tester);
|
|
|
|
await tester.enterText(find.byType(TextField), 'a' * 10);
|
|
await tester.pump();
|
|
expect(find.textContaining(' / ${TextLimits.name}'), findsNothing);
|
|
|
|
await tester.enterText(find.byType(TextField), 'a' * 35);
|
|
await tester.pump();
|
|
expect(find.text('35 / ${TextLimits.name}'), findsOneWidget);
|
|
|
|
await tester.enterText(find.byType(TextField), 'a' * 100);
|
|
await tester.pump();
|
|
expect(controller.text, hasLength(TextLimits.name));
|
|
expect(
|
|
find.text('${TextLimits.name} / ${TextLimits.name}'),
|
|
findsOneWidget,
|
|
);
|
|
});
|
|
}
|