New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for handling properties/css rules with no value #205
Conversation
…se not.toHaveStyleRule when rule defined for higher resolutions.
width: 50%; | ||
} | ||
` | ||
notToHaveStyleRule(<Button />, 'width') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MicheleBertoli I mentioned those changes in our previous discussion, as promised I deliver those as a separate PR. Changes were made due to the 'notToHaveStyleRule' check marked with this comment. It is a quick fix and probably there is a better way to do it. If you share any ideas I can try to fix in better way. In my old test suits such tests worked well and a scenario when you check lack of some rule seems to be useful when doing mobile first design. Anyway, I would like to get your opinion on it.
Thank you very much @dumbNickname for opening a separate PR. In #148 we implemented the current behaviour, and the reason was to be able to test this: If you want to negate the expectation, you can use the following statement: However, I would love to hear more about your use-case, and see why you can't do this: I would also love @santino (the author of the original PR) to chime in here. |
@dumbNickname if I understand correctly you are proposing to handle something like this: Although I'm not sure on the use case since the same result is achievable with However releasing your proposal would mean releasing a breaking change (because of the removed In addition to that the signature of Having said that I thought about what you want to achieve and if you look into how Right now the test simply fails because in this case we're using a negated I have now opened #206 to introduce the behaviour you're after without any breaking change. Hope this help. |
@santino Thanks for your detailed answer. As I wrote it was a quick fix and I expected that there has to be a better solution. I made this PR just to show the problem, did not really expect that this will be the final solution - as you wrote it would cause a breaking change. I have never reached the part of jest docs that you have mentioned, great to know that! I think this was the missing part for me, next time will try to prepare myself better ;). I could not wrap my head around how to change the matcher behavior to support Just a short comment on I took a look at your solution - looks exactly as what I needed. When it gets merged I will double check if it covers all of my project cases. @MicheleBertoli Please reject my PR ;) Thank you both for your help. |
Make it possible to use not.toHaveStyleRule when rule defined for higher resolutions.