xpe*_*dev 4 dart flutter flutter-test
鉴于这tester.enterText将使我能够TextField在抖动测试中输入文字,我该如何模拟按android键盘上的DONE键或在文本字段内按键盘上的ENTER键?
这也等同于检查是否按下了IOS / android键盘上的DONE按钮
我在抖动回购测试中找到了实现@ https://github.com/flutter/flutter/blob/7e445a17324ee7e615ef2c886d0cb9407853f338/packages/flutter/test/widgets/editable_text_test.dart#L558:
例如: await tester.testTextInput.receiveAction(TextInputAction.done);
// example
await tester.enterText(find.byKey(new Key('txtFieldKey')), 'Hello World!');
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
860 次 |
| 最近记录: |