From 2a3070f40cd7d966510de54e2711df6bfdc823e4 Mon Sep 17 00:00:00 2001 From: Patrick-Sachs <33065264+Patrick-Sachs@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:31:23 +0100 Subject: [PATCH 1/2] Use `getPropertyValue` to get style props --- chai-dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai-dom.js b/chai-dom.js index 5659496..9ffc22e 100644 --- a/chai-dom.js +++ b/chai-dom.js @@ -387,7 +387,7 @@ chai.Assertion.addMethod('style', function (styleProp, styleValue) { var el = flag(this, 'object'), style = window.getComputedStyle(el), - actual = style[styleProp]; + actual = style.getPropertyValue(styleProp); this.assert( actual === styleValue From c6b87371be1ef1f72eec3a49434bc82996a342f4 Mon Sep 17 00:00:00 2001 From: Patrick-Sachs <33065264+Patrick-Sachs@users.noreply.github.com> Date: Tue, 23 Nov 2021 16:48:06 +0100 Subject: [PATCH 2/2] Trim CSS property values --- chai-dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai-dom.js b/chai-dom.js index 9ffc22e..806e5ff 100644 --- a/chai-dom.js +++ b/chai-dom.js @@ -387,7 +387,7 @@ chai.Assertion.addMethod('style', function (styleProp, styleValue) { var el = flag(this, 'object'), style = window.getComputedStyle(el), - actual = style.getPropertyValue(styleProp); + actual = style.getPropertyValue(styleProp).trim(); this.assert( actual === styleValue