The error Cannot read properties of null (reading ‘1’) is given when the background-color property is not defined. For example, consider
$expect('body').to.have.css('background-color', '#f9f9f9', 'Did you apply a background color of `#f9f9f9` to the `body`?');
It works as expected when it is defined correctly or incorrectly; it gives the intended error message. However, if the background-color property is missing altogether, it gives the null message.
I'm not sure how many (or which) properties this bug affects but it doesn't happen with the color property. If I have a statement like this:
$expect('.subtitle').to.have.css(' color', '#333333', '`color` is not set to `#333333`.');
It displays the defined error message if the color property doesn't exist or isn't set correctly instead of null error.
I believe that's the expected behavior but I could be wrong. I'm just creating this issue for awareness. As per my Slack thread, we've gotten around this by using getComputedStyle.
The error
Cannot read properties of null (reading ‘1’)is given when thebackground-colorproperty is not defined. For example, considerIt works as expected when it is defined correctly or incorrectly; it gives the intended error message. However, if the
background-colorproperty is missing altogether, it gives thenullmessage.I'm not sure how many (or which) properties this bug affects but it doesn't happen with the
colorproperty. If I have a statement like this:It displays the defined error message if the
colorproperty doesn't exist or isn't set correctly instead ofnullerror.I believe that's the expected behavior but I could be wrong. I'm just creating this issue for awareness. As per my Slack thread, we've gotten around this by using
getComputedStyle.