Add TextEditingValue update test coverage (#9381)

Tests that updates to selection base/offset editing state is updated on
controller updates.

Tests TextEditingValue.clear() clears text.
This commit is contained in:
Chris Bracken
2017-04-13 12:13:30 -07:00
committed by GitHub
parent 76bebeed9d
commit 81fa81cd32

View File

@@ -953,8 +953,17 @@ void main() {
await tester.idle();
expect(tester.testTextInput.editingState['text'], equals('More Text'));
controller2.text = 'Final Text';
controller2.text = 'Additional Text';
await tester.idle();
expect(tester.testTextInput.editingState['text'], equals('Final Text'));
expect(tester.testTextInput.editingState['text'], equals('Additional Text'));
controller2.selection = const TextSelection(baseOffset: 0, extentOffset: 5);
await tester.idle();
expect(tester.testTextInput.editingState['selectionBase'], equals(0));
expect(tester.testTextInput.editingState['selectionExtent'], equals(5));
controller2.clear();
await tester.idle();
expect(tester.testTextInput.editingState['text'], equals(''));
});
}