Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseElement is missing in v7 #513

Closed
TAGraves opened this issue Aug 17, 2020 · 2 comments · Fixed by #533
Closed

baseElement is missing in v7 #513

TAGraves opened this issue Aug 17, 2020 · 2 comments · Fixed by #533

Comments

@TAGraves
Copy link
Collaborator

In v6, the result of calling render included a baseElement property (see https://www.native-testing-library.com/docs/next/api-main#baseelement). baseElement was the root element of the render result.

In v7, baseElement is no longer returned from render.

I do wonder if it would be better to just deprecate this and include a notice in the migration guide. Looking over our tests at Root, most of them seemed to be misunderstand what baseElement did anyway, and so our tests were written in a way that could never fail. For example I see a lot of cases like:

expect(baseElement).toBeEnabled()

but with v6's implementation, that would always return true -- since baseElement was a View rendered by the AppContainer and couldn't be disabled. In our internal PR migrating to v7 we replaced baseElement with the results of more specific queries and didn't have any problem.

@thymikee
Copy link
Member

I'm good with not adding that (no one actually requested the feature for years) and adding a note to the migration guide.

@mdjastrzebski
Copy link
Member

@TAGraves is baseElement something similar to container from React Testing Library?

container reference to the DOM node where the component is mounted
https://testing-library.com/docs/react-testing-library/cheatsheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants