From b57d45f27c8fc0556c53c6cfe52b235c9d102c57 Mon Sep 17 00:00:00 2001 From: Connor Meredith <4907463+connormeredith@users.noreply.github.com> Date: Thu, 14 Nov 2019 11:35:06 +0000 Subject: [PATCH] Fixed issue with lowercasing toHaveStyle values. --- src/__tests__/to-have-style.js | 5 +++++ src/to-have-style.js | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/__tests__/to-have-style.js b/src/__tests__/to-have-style.js index bce75f56..0771bd48 100644 --- a/src/__tests__/to-have-style.js +++ b/src/__tests__/to-have-style.js @@ -17,6 +17,7 @@ describe('.toHaveStyle', () => { color: white; float: left; transition: opacity 0.2s ease-out, top 0.3s cubic-bezier(1.175, 0.885, 0.32, 1.275); + transform: translateX(0px); } ` document.body.appendChild(style) @@ -49,6 +50,10 @@ describe('.toHaveStyle', () => { expect(container.querySelector('.label')).toHaveStyle(` Align-items: center; `) + + expect(container.querySelector('.label')).toHaveStyle(` + transform: translateX(0px); + `) }) test('handles negative test cases', () => { diff --git a/src/to-have-style.js b/src/to-have-style.js index f78272ef..e81303ea 100644 --- a/src/to-have-style.js +++ b/src/to-have-style.js @@ -19,8 +19,7 @@ function getStyleDeclaration(document, css) { function isSubset(styles, computedStyle) { return Object.entries(styles).every( ([prop, value]) => - computedStyle.getPropertyValue(prop.toLowerCase()) === - value.toLowerCase(), + computedStyle.getPropertyValue(prop.toLowerCase()) === value, ) }