Closed
Description
The following test fails with:
expect(element).toHaveStyle()
- Expected
- paddingLeft: ;
12 | />
13 | );
> 15 | expect(screen.getByPlaceholderText("example")).toHaveStyle({
16 | paddingLeft: 4
17 | });
18 | });
import React from "react";
import "@testing-library/jest-dom/extend-expect";
import { render, screen } from "@testing-library/react";
test("failing test", () => {
render(
<input
placeholder="example"
style={{
paddingLeft: 4
}}
/>
);
expect(screen.getByPlaceholderText("example")).toHaveStyle({
paddingLeft: 4
});
});
Am I using toHaveStyle()
the wrong way, or is this a bug?
The error message is also pretty confusing 😕
@testing-library/jest-dom
version: 5.11.1node
version: 12.6.0npm
version: 6.14.6react-testing-library
version: 10.4.7