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
toHaveStyleRule errors if component is empty #189
Comments
Thank you very much for opening this issue, @guyfedwards. |
Sure @MicheleBertoli, you can find the component here and the test here. You can see the second to last test case is the culprit, with a comment referencing this issue. If you want to clone the repo, the relevant branch is |
Hello @guyfedwards, I saw that weaveworks/ui-components#379 was merged. |
Oh sorry, I probably deleted the branch 🤦♂️ The issue still persists and you can see on master component & test Thanks @MicheleBertoli |
Thanks for providing more information, @guyfedwards. In any case, my recommendation is to set the ValidationMessage.displayName = 'ValidationMessage' And then: expect(wrapper.find('ValidationMessage')).toHaveStyleRule(
'visibility',
'visible'
); |
@MicheleBertoli The test passes as I have added the following lines to make it pass:
That comment referencing this issue as the reason for the content being set. Apologies for not being clearer. |
Yay! Found the issue, and fixed it. |
no need to pass message now just to satisfy issue in upstream lib jest-styled-components upstream issue: styled-components/jest-styled-components#189
When the component that has
.toHaveStyleRule
call on it, it errors. As you can see below,expect(wrapper.find('Input__ValidationMessage').length).toBe(1)
passes.Adding some child text to the component causes the test to pass.
The text was updated successfully, but these errors were encountered: