initializeTestUIRoot<U extends UIRoot> function

Future<U> initializeTestUIRoot<U extends UIRoot>(
  1. U uiRootInstantiator(
    1. UIElement rootContainer
    ), {
  2. String outputDivID = 'test-output',
  3. Duration initialRenderTimeout = const Duration(seconds: 5),
  4. bool closeOnTearDown = true,
})

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 a setUpAll (as usual), it's after all the tests of that setUpAll's group (the whole file for a top-level one); called in a test, after that test. It runs before the group's own tearDownAlls. 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,
  ),
);