React selector not finding component if it is inside nested root containerSee original GitHub issue
This is not an issue if it is react 15 , since it is relying on
data-reactroot attribute on the element and
const rootEls = .slice.call(document.querySelectorAll('[data-reactroot]')); this code will find all nested root containers.
In react 16 the way to identify root container is using object key
getRootElsReact16(el) only looking for peers not nested containers.
For e.g. it will work in below structure
<div/> // First root container
<div/> // Second root container (peer of first)
Will not work in below structure (In this case it will find components that is part of first root container , not from second and Third root container)
<div> // First root container
<div> // Second root container (Nested inside First)
<div>// Not a react container
<div> // Third root container (Nested inside First)
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Thank you for the example, I’ve reproduced the issue.
Thank you that was quick!!
On Mon, Jan 13, 2020 at 4:37 AM Boris Kirov email@example.com wrote:
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DevExpress/testcafe-react-selectors/issues/159?email_source=notifications&email_token=AAOO45XKDFFWXJXQT6BNG43Q5ROBBA5CNFSM4KCTVUOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIYRS3A#issuecomment-573643116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOO45SXELU4QNV6V5JVR6DQ5ROBBANCNFSM4KCTVUOA .