-
Notifications
You must be signed in to change notification settings - Fork 668
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
isVisible doesn't check visibility due to CSS classes #1456
Comments
This is not possible because of jsdom limitations as far as I know. I tried implementing this once. If you are interested in why, read a bit more here and see all the regular techniques for knowing is css is hiding an element here. Normally you use things like I'm sorry, for the limitations of jsom explained above, we will not be able to support this feature. |
This appears to have been fixed in v2 with vuejs/test-utils#454. Any chance of backporting to v1 for those of us still on Vue 2? |
+1 to IGx89's sentiment |
Sure thing, would you be interested in making a PR? If you do, please tag me in the PR, I can review it for you. |
Sure can! Have unit tests passing, however it's failing when run in the browser using Karma -- breaks most isVisible tests. vue-test-utils v2 doesn't run tests in the browser so it doesn't have to deal with that issue. Will need to dig into it more to find the root cause -- sadly doesn't appear to be as simple as just copying the changes over. |
Found the root cause, pretty interesting stuff :). PR submitted: #2013. Note that this will only work on attached elements, so the example above would need to have this change:
|
Hello, I'm still getting this issue when I try to use isVisible when using a css class setting opacity to 0 after getting the 1.3.4 version. |
Getting the issue with V3 even after attaching to document.body |
It looks like opacity should work: https://github.com/vuejs/test-utils/pull/454/files Please provide a minimal reproduction, that is the only way anyone can help. |
Minimal reproduction: Run Instructions: In HomeView.vue there is a div with a class called "class" and dummy text, the class applies opacity: 0 and the text is not visible, you can remove the class to check that the opacity in fact hides it. test.test.ts mounts the HomeView,finds the element and then checks if isVisible. Test fails. |
What problem does this feature solve?
Making test for components like this
What does the proposed API look like?
Call of isVisible will be the same as before
The text was updated successfully, but these errors were encountered: