Skip to content

toHaveStyle failing for upper cased style rules in version 4.1.2 #148

Closed
@ppiyush13

Description

@ppiyush13

@testing-library/jest-dom library version: 4.1.2

Consider the following div element:

<div id="simple" style="align-items:center">Simple Div</div>

I am using toHaveStyle to match CSS style rules as shown below

const div = document.querySelector("#simple");

expect(div).toHaveStyle('Align-items:center;');

Expected:
It should not throw error and proceed ahead

Actual:
It fails.

But below works fine

const div = document.querySelector("#simple");

expect(div).toHaveStyle('align-items:center;');

Seems that toHaveStyle needs CSS rules to be in lower case.
But this was working as expected in version 4.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions