Skip to content

baseElement is missing in v7 #513

Closed
@TAGraves

Description

@TAGraves

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions