enterText to move the caret to the end (#79506)
This commit is contained in:
@@ -7,6 +7,24 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('enterText works', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Material(
|
||||
child: TextField(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final EditableTextState state = tester.state(find.byType(EditableText));
|
||||
expect(state.textEditingValue.text, '');
|
||||
|
||||
await tester.enterText(find.byType(EditableText), 'let there be text');
|
||||
expect(state.textEditingValue.text, 'let there be text');
|
||||
expect(state.textEditingValue.selection.isCollapsed, isTrue);
|
||||
expect(state.textEditingValue.selection.baseOffset, 17);
|
||||
});
|
||||
|
||||
testWidgets('receiveAction() forwards exception when exception occurs during action processing', (WidgetTester tester) async {
|
||||
// Setup a widget that can receive focus so that we can open the keyboard.
|
||||
const Widget widget = MaterialApp(
|
||||
|
||||
Reference in New Issue
Block a user