|
@@ -1,6 +1,7 @@
|
1
|
1
|
// Copyright (c) 2018, the Zefyr project authors. Please see the AUTHORS file
|
2
|
2
|
// for details. All rights reserved. Use of this source code is governed by a
|
3
|
3
|
// BSD-style license that can be found in the LICENSE file.
|
|
4
|
+import 'package:flutter/widgets.dart';
|
4
|
5
|
import 'package:flutter_test/flutter_test.dart';
|
5
|
6
|
import 'package:zefyr/zefyr.dart';
|
6
|
7
|
|
|
@@ -11,15 +12,21 @@ void main() {
|
11
|
12
|
testWidgets('user input', (tester) async {
|
12
|
13
|
final editor = new EditorSandBox(tester: tester);
|
13
|
14
|
await editor.tapEditor();
|
14
|
|
- await enterText(tester, 'Test');
|
15
|
|
- expect(editor.document.toPlainText(), startsWith('Test'));
|
|
15
|
+ final currentValue = editor.document.toPlainText();
|
|
16
|
+ await enterText(tester, 'Added $currentValue');
|
|
17
|
+ expect(editor.document.toPlainText(), 'Added This House Is A Circus\n');
|
16
|
18
|
});
|
17
|
19
|
});
|
18
|
20
|
}
|
19
|
21
|
|
20
|
22
|
Future<Null> enterText(WidgetTester tester, String text) async {
|
21
|
23
|
return TestAsyncUtils.guard(() async {
|
22
|
|
- tester.testTextInput.enterText(text);
|
|
24
|
+ tester.testTextInput.updateEditingValue(
|
|
25
|
+ new TextEditingValue(
|
|
26
|
+ text: text,
|
|
27
|
+ selection: new TextSelection.collapsed(offset: 6),
|
|
28
|
+ ),
|
|
29
|
+ );
|
23
|
30
|
await tester.idle();
|
24
|
31
|
});
|
25
|
32
|
}
|