-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add test for focus_node.unfocus.0.dart
#157673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for focus_node.unfocus.0.dart
#157673
Conversation
| await tester.tap(find.byType(TextField).first); // Focuses the first text field. | ||
| await tester.pump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await tester.tap(find.byType(TextField).first); // Focuses the first text field. | |
| await tester.pump(); | |
| // Focuses the first text field. | |
| await tester.tap(find.byType(TextField).first); | |
| await tester.pump(); |
Cosmetic change to use the same commenting approach than below.
bleroux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! with minor comments
| expect( | ||
| find.descendant( | ||
| of: find.byType(TextField).first, | ||
| matching: find.byWidgetPredicate( | ||
| (Widget focus) => focus is Focus && (focus.focusNode?.hasFocus ?? false), | ||
| ), | ||
| ), | ||
| findsOne, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it is better, but if you want something shorter, the following is probably ok:
final EditableText firstEditableText = tester.firstWidget(find.byType(EditableText));
expect(firstEditableText.focusNode.hasFocus, true);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure ! I changed it in test: Shorter expects
| await tester.tap(find.byType(TextField).first); // Focuses the first text field. | ||
| await tester.pump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await tester.tap(find.byType(TextField).first); // Focuses the first text field. | |
| await tester.pump(); | |
| // Focuses the first text field. | |
| await tester.tap(find.byType(TextField).first); | |
| await tester.pump(); |
a3fa482 to
cdee05f
Compare
flutter/flutter@5a11904...3fb95c7 2024-10-28 [email protected] Roll Flutter Engine from bf5bfeebf89f to 23b2c6d3b3b1 (3 revisions) (flutter/flutter#157736) 2024-10-28 [email protected] Avoid labeling 'context' PRs as 'text-input' (flutter/flutter#157650) 2024-10-28 [email protected] Add test for `restorable_route_future.0.dart` (flutter/flutter#157708) 2024-10-28 [email protected] Update .ci.yaml have android sdk be 35v1 (flutter/flutter#157621) 2024-10-28 [email protected] Roll Flutter Engine from 2522789c4199 to bf5bfeebf89f (1 revision) (flutter/flutter#157713) 2024-10-28 [email protected] Add test for `restoration_mixin.0.dart` (flutter/flutter#157709) 2024-10-28 [email protected] Add test for `navigator.restorable_push_replacement.0.dart` (flutter/flutter#157704) 2024-10-28 [email protected] Add test for `focus_node.unfocus.0.dart` (flutter/flutter#157673) 2024-10-28 [email protected] Roll Flutter Engine from 9226b089d634 to 2522789c4199 (2 revisions) (flutter/flutter#157710) 2024-10-28 [email protected] Add tests for `navigator_state.restorable_push.0.dart` (flutter/flutter#157667) 2024-10-28 [email protected] Roll Flutter Engine from 10e50bd42c42 to 9226b089d634 (1 revision) (flutter/flutter#157702) 2024-10-28 [email protected] Add test for `navigator_state.restorable_push_replacement.0.dart` (flutter/flutter#157668) 2024-10-28 [email protected] Remove unsafe_html lint rule (flutter/flutter#157531) 2024-10-27 [email protected] Roll Flutter Engine from 3162aaad0086 to 10e50bd42c42 (1 revision) (flutter/flutter#157690) 2024-10-27 [email protected] Fix Scaffold extend body (flutter/flutter#157441) 2024-10-26 [email protected] Roll Flutter Engine from c9b8ac96f6ce to 3162aaad0086 (3 revisions) (flutter/flutter#157681) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Contributes to #130459
It adds a test for
examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dartPre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.