Unverified Commit 39499bd2 authored by Michael Bui's avatar Michael Bui Committed by GitHub

make showKeyboard respect finder's skipOffstage value (#79034)

parent 462ad790
......@@ -1031,7 +1031,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
final EditableTextState editable = state<EditableTextState>(
find.descendant(
of: finder,
matching: find.byType(EditableText),
matching: find.byType(EditableText, skipOffstage: finder.skipOffstage),
matchRoot: true,
),
);
......
......@@ -611,25 +611,42 @@ void main() {
});
});
testWidgets('showKeyboard can be called twice', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Center(
child: TextFormField(),
group('showKeyboard', () {
testWidgets('can be called twice', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Center(
child: TextFormField(),
),
),
),
),
);
await tester.showKeyboard(find.byType(TextField));
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
await tester.showKeyboard(find.byType(TextField));
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
await tester.showKeyboard(find.byType(TextField));
await tester.showKeyboard(find.byType(TextField));
await tester.pump();
);
await tester.showKeyboard(find.byType(TextField));
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
await tester.showKeyboard(find.byType(TextField));
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
await tester.showKeyboard(find.byType(TextField));
await tester.showKeyboard(find.byType(TextField));
await tester.pump();
});
testWidgets(
'can focus on offstage text input field if finder says not to skip offstage nodes',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Offstage(
child: TextFormField(),
),
),
),
);
await tester.showKeyboard(find.byType(TextField, skipOffstage: false));
});
});
testWidgets('verifyTickersWereDisposed control test', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment