diff --git a/src/__tests__/to-have-style.js b/src/__tests__/to-have-style.js index 35b77256..bce75f56 100644 --- a/src/__tests__/to-have-style.js +++ b/src/__tests__/to-have-style.js @@ -12,6 +12,7 @@ describe('.toHaveStyle', () => { const style = document.createElement('style') style.innerHTML = ` .label { + align-items: center; background-color: black; color: white; float: left; @@ -44,6 +45,10 @@ describe('.toHaveStyle', () => { color: white; font-weight: bold; `) + + expect(container.querySelector('.label')).toHaveStyle(` + Align-items: center; + `) }) test('handles negative test cases', () => { diff --git a/src/to-have-style.js b/src/to-have-style.js index 6552f67e..f78272ef 100644 --- a/src/to-have-style.js +++ b/src/to-have-style.js @@ -18,7 +18,9 @@ function getStyleDeclaration(document, css) { function isSubset(styles, computedStyle) { return Object.entries(styles).every( - ([prop, value]) => computedStyle.getPropertyValue(prop) === value, + ([prop, value]) => + computedStyle.getPropertyValue(prop.toLowerCase()) === + value.toLowerCase(), ) }