@@ -24,15 +24,22 @@ void main() {
24
24
/// test that binding to a TextInput works properly in the same scope
25
25
/// and also in a custom widget's scope
26
26
testWidgets ("Bindings to widget's value" , (tester) async {
27
- await TestHelper .loadScreen (tester, 'Widget Bindings' , config);
28
- // await tester.pumpAndSettle();
27
+ await TestHelper .loadScreen (tester, 'Custom Widget' , config);
29
28
30
29
// TextInput has initial value of 'first'
31
30
// so first make sure our EnsembleText is correctly bind to that
32
31
Finder text = find.descendant (
33
32
of: find.byType (EnsembleText ), matching: find.text ('first' ));
34
33
expect (text, findsOneWidget);
35
34
35
+ // Custom Widget's onLoad can access inputs
36
+ // search for toast message
37
+ await tester.pumpAndSettle ();
38
+ expect (find.text ('Hello first' ), findsOneWidget);
39
+
40
+ // ensure Nested widget's onLoad can access inputs via JS too
41
+ expect (find.text ('Hi first' ), findsOneWidget);
42
+
36
43
// Custom Widget's text should also bind to the same value
37
44
Finder customText = find.descendant (
38
45
of: find.byType (EnsembleText ),
@@ -68,6 +75,9 @@ void main() {
68
75
of: find.byType (EnsembleText ),
69
76
matching: find.text ('Custom Custom Widget: second' ));
70
77
expect (customCustomText, findsOneWidget);
78
+
79
+ // ensure onLoad never run again and still retain original value
80
+ expect (find.text ('Hi first' ), findsOneWidget);
71
81
});
72
82
73
83
/// test bindings to API is working properly
0 commit comments