11import 'package:fleather/fleather.dart' ;
2+ import 'package:fleather/src/widgets/editor_input_client_mixin.dart' ;
23import 'package:fleather/src/widgets/history.dart' ;
34import 'package:flutter/material.dart' ;
45import 'package:flutter/services.dart' ;
6+ import 'package:flutter/widgets.dart' ;
57import 'package:flutter_test/flutter_test.dart' ;
68import 'package:quill_delta/quill_delta.dart' ;
79
@@ -137,9 +139,17 @@ void main() {
137139 ..delete (5 )
138140 ..insert ('mmmmm,' , {'i' : true }));
139141 await editor.pump ();
140- await editor.enterText (const TextEditingValue (
141- text: 'Something in the way mmmmm,\n ' ,
142- selection: TextSelection .collapsed (offset: 26 )));
142+ final inputClient = getInputClient ();
143+ inputClient.openConnectionIfNeeded ();
144+ inputClient.updateEditingValueWithDeltas ([
145+ const TextEditingDeltaInsertion (
146+ oldText: 'Something in the way mmmmm' ,
147+ textInserted: ',' ,
148+ insertionOffset: initialLength,
149+ selection: TextSelection .collapsed (offset: 26 ),
150+ composing: TextRange .collapsed (26 ))
151+ ]);
152+
143153 // Throttle time of 500ms in history
144154 await tester.pump (const Duration (milliseconds: 500 ));
145155 await tester.pumpAndSettle ();
@@ -204,6 +214,16 @@ void main() {
204214 Future <void > enterText (TextEditingValue text) async {
205215 return TestAsyncUtils .guard <void >(() async {
206216 await showKeyboard ();
217+ final inputClient = getInputClient ();
218+ inputClient.updateEditingValueWithDeltas ([
219+ TextEditingDeltaInsertion (
220+ oldText: inputClient.textEditingValue.text,
221+ textInserted: text.text,
222+ insertionOffset: 0 ,
223+ selection: text.selection,
224+ composing: text.composing,
225+ )
226+ ]);
207227 tester.binding.testTextInput.updateEditingValue (text);
208228 await tester.idle ();
209229 await tester.pumpAndSettle ();
@@ -224,7 +244,7 @@ void main() {
224244 await tester.tap (find.byType (TextButton ));
225245
226246 await enterText (const TextEditingValue (
227- text: 'Something in the way mmmmm\n ' ,
247+ text: 'Something in the way mmmmm' ,
228248 selection: TextSelection .collapsed (offset: 26 )));
229249 // Throttle time of 500ms in history
230250 await tester.pump (const Duration (milliseconds: 500 ));
0 commit comments