@@ -13,6 +13,7 @@ import 'dart:js';
13
13
import 'dart:js_util' ;
14
14
15
15
import "package:js/js.dart" ;
16
+ import 'package:meta/meta.dart' ;
16
17
17
18
import "package:react/react.dart" ;
18
19
import 'package:react/react_client/js_interop_helpers.dart' ;
@@ -53,6 +54,21 @@ dynamic listifyChildren(dynamic children) {
53
54
}
54
55
}
55
56
57
+ /// The zone in which React will call component lifecycle methods.
58
+ ///
59
+ /// This can be used to sync a test's zone and React's component zone, ensuring that component prop callbacks and
60
+ /// lifecycle method output all occurs within the same zone as the test.
61
+ ///
62
+ /// __Example:__
63
+ ///
64
+ /// test('zone test', () {
65
+ /// componentZone = Zone.current;
66
+ ///
67
+ /// // ... test your component
68
+ /// }
69
+ @visibleForTesting
70
+ Zone componentZone = Zone .root;
71
+
56
72
/// Use [ReactDartComponentFactoryProxy2] instead.
57
73
///
58
74
/// Will be removed when [Component] is removed in the `6.0.0` release.
@@ -473,10 +489,6 @@ final ReactDartInteropStatics _dartInteropStatics = (() {
473
489
})();
474
490
475
491
abstract class _ReactDartInteropStatics2 {
476
- // TODO 3.1.0-wip expose for testing?
477
- /// The zone in which all component lifecycle methods are run.
478
- static final componentZone = Zone .root;
479
-
480
492
static void _updatePropsAndStateWithJs (Component2 component, JsMap props, JsMap state) {
481
493
component
482
494
..props = new JsBackedMap .backedBy (props)
0 commit comments