Skip to content

Error: ReferenceError: SVGElement is not defined when isVisible() is called on an SVG element. #2024

Closed
@3rdvision

Description

@3rdvision

Subject of the issue

A test will fails and throw ReferenceError: SVGElement is not defined when calling isVisible() on an SVG element.

Expected behaviour

Can correctly verify if an SVG Element is visible.

Actual behaviour

Throws an error when verifying if an SVG Element is visible.

Possible Solution

The issue was introduced here with the purpose to make isVisible more comprehensive. This was ported from jest-dom as it is declared on the function comment but looking at js-dom repository they don't have instanceof SVGElement but, instead instanceof window.SVGElement which makes sense. Also, I have tried this fix and it worked so I will open PR with this suggested change and let you guys decide.

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