2026-11-03 21:27:16 +01:00
|
|
|
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() {
|
|
|
|
|
testWidgets('the explanation stays hidden until the question mark is '
|
|
|
|
|
'tapped, then shows under its title and closes again', (tester) async {
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
testApp(
|
|
|
|
|
const Scaffold(
|
|
|
|
|
body: HelpButton('How sources are cited.', title: 'Citation style'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
expect(find.text('How sources are cited.'), findsNothing);
|
|
|
|
|
expect(find.byTooltip("What's this?"), findsOneWidget);
|
|
|
|
|
|
|
|
|
|
await tester.tap(find.byType(HelpButton));
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
expect(find.text('Citation style'), findsOneWidget);
|
|
|
|
|
expect(find.text('How sources are cited.'), findsOneWidget);
|
|
|
|
|
|
|
|
|
|
await tester.tap(find.text('OK'));
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
expect(find.text('How sources are cited.'), findsNothing);
|
|
|
|
|
});
|
2026-11-03 22:02:05 +01:00
|
|
|
testWidgets('an action offered stands beside OK', (tester) async {
|
|
|
|
|
var read = false;
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
testApp(
|
|
|
|
|
Scaffold(
|
|
|
|
|
body: HelpButton(
|
|
|
|
|
'Map by OpenFreeMap.',
|
|
|
|
|
action: (label: 'What it keeps', onPressed: () => read = true),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
await tester.tap(find.byType(HelpButton));
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
await tester.tap(find.text('What it keeps'));
|
|
|
|
|
expect(read, isTrue);
|
|
|
|
|
expect(find.text('OK'), findsOneWidget);
|
|
|
|
|
});
|
2026-11-03 21:27:16 +01:00
|
|
|
}
|