瀏覽代碼

Fixed test and adjusted dependency to work with current Flutter beta

Anatoly Pulyaevskiy 6 年之前
父節點
當前提交
9294db171c
共有 2 個檔案被更改,包括 11 行新增4 行删除
  1. 1
    1
      packages/zefyr/pubspec.yaml
  2. 10
    3
      packages/zefyr/test/widgets/editable_text_test.dart

+ 1
- 1
packages/zefyr/pubspec.yaml 查看文件

@@ -16,4 +16,4 @@ dependencies:
16 16
 dev_dependencies:
17 17
   flutter_test:
18 18
     sdk: flutter
19
-  test: ^0.12.41
19
+  test: ^0.12.37

+ 10
- 3
packages/zefyr/test/widgets/editable_text_test.dart 查看文件

@@ -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
 }