selectWhere<O extends Element> method

UITestChainNode<U, List<O>, T> selectWhere<O extends Element>(
  1. String? selectors,
  2. bool test(
    1. Element element
    ), {
  3. bool expected = false,
})

Alias to querySelectorAll + where.

Implementation

UITestChainNode<U, List<O>, T> selectWhere<O extends Element>(
    String? selectors, bool Function(Element element) test,
    {bool expected = false}) {
  var sel = querySelectorAll(selectors);
  var elems = sel.element.whereType<O>().where(test).toList();

  if (expected) {
    expect(elems.isNotEmpty, isTrue,
        reason: "Can't find selected elements: $selectors");
  }

  return UITestChainNode(testChainRoot, elems, this as T);
}