findDescendantsWithProp function
Returns all descendants of a component that contain the specified prop key.
Implementation
List findDescendantsWithProp(/* [1] */ root, dynamic propKey) {
List descendantsWithProp = react_test_utils.findAllInRenderedTree(root, allowInterop((descendant) {
if (descendant == root) {
return false;
}
Map? props;
if (react_test_utils.isDOMComponent(descendant)) {
props = findDomNode(descendant)!.attributes;
} else if (react_test_utils.isCompositeComponent(descendant)) {
props = getProps(descendant);
}
return props != null && props.containsKey(propKey);
}));
return descendantsWithProp;
}