Skip to content

Typo'ed or invalid styles pass toHaveStyle #128

Closed
@dmwyatt

Description

@dmwyatt
  • @testing-library/jest-dom version: 4.1.0
  • node version: 12.8.0
  • npm (or yarn) version: 6.11.2

Relevant code or config:

it("should not pass", () => {
    const { getByText } = render(
      <span style={{ textDecoration: "line-through" }}>some text</span>
    );

    expect(getByText("some text")).toHaveStyle("hahaha:not a style");
  })

Problem description:

That test should fail, but any typo or invalid style will pass.

Suggested solution:

Get #81 into an acceptable state.

I'm mainly opening this issue to help others who might run into this pretty important bug.

I'm sure people using this library currently have tests that are passing that should not.

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