Skip to content

Matchers (except toHaveTextContent) should support any Element #313

Open
@nickserv

Description

@nickserv

Relevant code or config:

expect(svgElement).toBeVisible();

What happened:

received value must be an HTMLElement or an SVGElement.

Problem description:

Several Testing Libraries are having their TypeScript types updated to take Element rather than HTMLElement as arguments so other element types like SVGElement are allowed. However, Jest DOM performs runtime checks against HTMLElement and SVGElement, so that any other element type would fail.

Suggested solution:

We should update our typechecking to check instanceof Element for consistency with #306 and testing-library/react-testing-library#833.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions