WidgetTester enterText() and showKeyboard() can specify an EditableText ancestor (#9398)

This commit is contained in:
Hans Muller
2017-04-14 15:41:30 -07:00
committed by GitHub
parent dbfa747b37
commit 80a8c5629e
5 changed files with 92 additions and 40 deletions

View File

@@ -184,6 +184,30 @@ void main() {
contains('Actual: ?:<zero widgets with text "bar" that has ancestor(s) with type Column with text "foo"')
);
});
testWidgets('Root not matched by default', (WidgetTester tester) async {
await tester.pumpWidget(new Row(children: <Widget>[
new Column(children: <Text>[const Text('foo'), const Text('bar')])
]));
expect(find.descendant(
of: find.widgetWithText(Row, 'foo'),
matching: find.byType(Row),
), findsNothing);
});
testWidgets('Match the root', (WidgetTester tester) async {
await tester.pumpWidget(new Row(children: <Widget>[
new Column(children: <Text>[const Text('foo'), const Text('bar')])
]));
expect(find.descendant(
of: find.widgetWithText(Row, 'foo'),
matching: find.byType(Row),
matchRoot: true,
), findsOneWidget);
});
});
testWidgets('hasRunningAnimations control test', (WidgetTester tester) async {