Skip to content

False positives from toHaveStyle #657

@jmpainter

Description

@jmpainter
  • @testing-library/jest-dom version: latest

Relevant code or config:

The following assertions will always pass if the element doesn't have that CSS property set in style:

expect(element).toHaveStyle("border: fakefake");
expect(element).toHaveStyle("background: fakefake");

Suggested solution:

Fix needs to be made in to-have-style.js getStyleDeclaration. expected will be '' (empty string) in toHaveStyle.

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