File tree Expand file tree Collapse file tree 3 files changed +41
-4
lines changed
examples/api/test/widgets/focus_traversal Expand file tree Collapse file tree 3 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,6 @@ final Set<String> _knownMissingTests = <String>{
343
343
'examples/api/test/widgets/scroll_position/scroll_metrics_notification.0_test.dart' ,
344
344
'examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart' ,
345
345
'examples/api/test/widgets/animated_list/animated_list.0_test.dart' ,
346
- 'examples/api/test/widgets/focus_traversal/ordered_traversal_policy.0_test.dart' ,
347
346
'examples/api/test/widgets/image/image.frame_builder.0_test.dart' ,
348
347
'examples/api/test/widgets/image/image.loading_builder.0_test.dart' ,
349
348
'examples/api/test/widgets/page_storage/page_storage.0_test.dart' ,
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ import 'package:flutter_api_samples/widgets/focus_traversal/focus_traversal_grou
8
8
import 'package:flutter_test/flutter_test.dart' ;
9
9
10
10
void main () {
11
- bool hasFocus (WidgetTester tester, String text) {
12
- return Focus .of (tester.element (find.text (text))).hasPrimaryFocus;
13
- }
11
+ bool hasFocus (WidgetTester tester, String text) {
12
+ return Focus .of (tester.element (find.text (text))).hasPrimaryFocus;
13
+ }
14
14
15
15
testWidgets ('The focus updates should follow the focus traversal groups policy' , (WidgetTester tester) async {
16
16
await tester.pumpWidget (
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import 'package:flutter/material.dart' ;
6
+ import 'package:flutter/services.dart' ;
7
+ import 'package:flutter_api_samples/widgets/focus_traversal/ordered_traversal_policy.0.dart' as example;
8
+ import 'package:flutter_test/flutter_test.dart' ;
9
+
10
+ void main () {
11
+ bool hasFocus (WidgetTester tester, String text) {
12
+ return Focus .of (tester.element (find.text (text))).hasPrimaryFocus;
13
+ }
14
+
15
+ testWidgets ('The focus updates should follow the focus traversal groups policy' , (WidgetTester tester) async {
16
+ await tester.pumpWidget (
17
+ const example.OrderedTraversalPolicyExampleApp (),
18
+ );
19
+
20
+ expect (hasFocus (tester, 'One' ), isTrue);
21
+
22
+ const List <String > focusOrder = < String > [
23
+ 'Two' ,
24
+ 'Three' ,
25
+ 'Four' ,
26
+ 'Five' ,
27
+ 'Six' ,
28
+ 'One' ,
29
+ ];
30
+
31
+ for (final String text in focusOrder) {
32
+ await tester.sendKeyEvent (LogicalKeyboardKey .tab);
33
+ await tester.pump ();
34
+
35
+ expect (hasFocus (tester, text), isTrue);
36
+ }
37
+ });
38
+ }
You can’t perform that action at this time.
0 commit comments