initializeTestUIRoot<U extends UIRoot> function
Initializes the test UIRoot using the uiRootInstantiator to instantiate it.
- If
closeOnTearDown(the default), the root is shut down after the tests, once idle: UIRoot.whenIdle, then UIRoot.close (its components disposed, their async contents stopped). Called in asetUpAll(as usual), it's after all the tests of thatsetUpAll's group (the whole file for a top-level one); called in a test, after that test. It runs before the group's owntearDownAlls. Without it, a test file ended with the root's renders, async contents and timers still pending.
Implementation
Future<U> initializeTestUIRoot<U extends UIRoot>(
U Function(UIElement rootContainer) uiRootInstantiator, {
String outputDivID = 'test-output',
Duration initialRenderTimeout = const Duration(seconds: 5),
bool closeOnTearDown = true,
}) => _chainCapture(
() => _initializeTestUIRootImpl<U>(
uiRootInstantiator,
outputDivID,
initialRenderTimeout,
closeOnTearDown,
),
);