Skip to content

Typo'ed or invalid styles pass toHaveStyle #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dmwyatt opened this issue Aug 23, 2019 · 1 comment
Closed

Typo'ed or invalid styles pass toHaveStyle #128

dmwyatt opened this issue Aug 23, 2019 · 1 comment

Comments

@dmwyatt
Copy link

dmwyatt commented Aug 23, 2019

  • @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.

@Avi-Cohen-Nehemia
Copy link

@dmwyatt looks like the PR you linked has been merged. Can you close the issue if the problem is fixed?

@dmwyatt dmwyatt closed this as completed Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants