Merge branch 'learn-fb' into integration
This commit is contained in:
commit
918080ce46
1 changed files with 2471 additions and 368 deletions
52
packages/halkyon_ui/test/widget/explained_title_test.dart
Normal file
52
packages/halkyon_ui/test/widget/explained_title_test.dart
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
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('a title with its question mark right beside it, the '
|
||||
'explanation opening under the title', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
testApp(
|
||||
const Scaffold(
|
||||
body: SizedBox(
|
||||
width: 300,
|
||||
child: ListTile(
|
||||
title: ExplainedTitle(
|
||||
'Check spelling',
|
||||
help: 'Underlines possible mistakes.',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.text('Underlines possible mistakes.'), findsNothing);
|
||||
final title = tester.getRect(find.text('Check spelling'));
|
||||
final help = tester.getRect(find.byType(HelpButton));
|
||||
expect(help.left - title.right, lessThan(8), reason: 'beside it');
|
||||
|
||||
await tester.tap(find.byType(HelpButton));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Check spelling'), findsNWidgets(2));
|
||||
expect(find.text('Underlines possible mistakes.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a long title wraps, its question mark kept', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
testApp(
|
||||
Scaffold(
|
||||
body: SizedBox(
|
||||
width: 200,
|
||||
child: ExplainedTitle('A title ' * 20, help: 'Why.'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.byType(HelpButton), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue