Minor widget_tester refactoring and docs (#3472)
This reorders some classes so that this file makes more sense, and adds a bunch of docs. It also makes the following changes: * Move allElements from Instrumentation to TestWidgets. (Instrumentation is going away.) * Remove findElements. * Rename byElement to byElementPredicate * Rename byPredicate to byWidgetPredicate * Implement _WidgetPredicateFinder so that byWidgetPredicate has good messages * Fix one use of byElementPredicate to use byWidgetPredicate.
This commit is contained in:
@@ -14,14 +14,14 @@ import '../lib/gallery/item.dart' as material_gallery;
|
||||
const List<String> demoCategories = const <String>['Demos', 'Components', 'Style'];
|
||||
|
||||
Finder findGalleryItemByRouteName(WidgetTester tester, String routeName) {
|
||||
return find.byPredicate((Widget widget) {
|
||||
return find.byWidgetPredicate((Widget widget) {
|
||||
return widget is material_gallery.GalleryItem
|
||||
&& widget.routeName == routeName;
|
||||
});
|
||||
}
|
||||
|
||||
Finder byTooltip(WidgetTester tester, String message) {
|
||||
return find.byPredicate((Widget widget) {
|
||||
return find.byWidgetPredicate((Widget widget) {
|
||||
return widget is Tooltip && widget.message == message;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user