Skip to content

Commit 9a36d66

Browse files
connormeredithgnapse
authored andcommitted
fix: Changed .toHaveStyle() to be case-insensitive. (#154)
1 parent f881e68 commit 9a36d66

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/__tests__/to-have-style.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('.toHaveStyle', () => {
1212
const style = document.createElement('style')
1313
style.innerHTML = `
1414
.label {
15+
align-items: center;
1516
background-color: black;
1617
color: white;
1718
float: left;
@@ -44,6 +45,10 @@ describe('.toHaveStyle', () => {
4445
color: white;
4546
font-weight: bold;
4647
`)
48+
49+
expect(container.querySelector('.label')).toHaveStyle(`
50+
Align-items: center;
51+
`)
4752
})
4853

4954
test('handles negative test cases', () => {

src/to-have-style.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ function getStyleDeclaration(document, css) {
1818

1919
function isSubset(styles, computedStyle) {
2020
return Object.entries(styles).every(
21-
([prop, value]) => computedStyle.getPropertyValue(prop) === value,
21+
([prop, value]) =>
22+
computedStyle.getPropertyValue(prop.toLowerCase()) ===
23+
value.toLowerCase(),
2224
)
2325
}
2426

0 commit comments

Comments
 (0)