-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
feat: make toBeVisible take into account 'hidden' attribute #97
Comments
Weird. Spectator just uses jQuery for that But I know that hidden is not always really hidden, it may depend on the browsers default styling. What browser are you using for your unit test? |
As you can see here, the hidden attribute is not taken into account (or, at least, it's not mentioned). I'm using Jest as testing framework. |
I tried to reproduce (we use Jest too), but I noticed that the matchers doesn't work at all on Jest. Found out that Maybe it would work if Spectator downgrades to jQuery 1. Not sure if that is a good idea. |
It doesn't seem like they are going to fix this at all... |
We could also just change it to @NetanelBasal what do you think? |
Will it work for you? |
I guess yes for my use case, but it won't solve problems with jQuery and jsdom 🤔 |
You can submit a PR that replace this with native JS implementation if you want. |
I'm trying to change the implementation but I would like to keep
for Jasmine (to keep the code cleaner and more performant) and only switch back to jQuery 1 implementation for Jest, probably something like
Is it possible to register different version of the matcher for the two testing frameworks? Another possibility is the one proposed here which changes the Is there a place where I can safely put that code to make it work only when tests are run with Jest? |
I would keep it simple and go with something that works. |
It depends on your perception of "something that works", given that it's always a matter of tradeoffs:
I can also try to use the prototype code (which checks all parents of the given element for visibility hints) directly inside the matcher if you prefer, but the code will be uglier |
What about plain old JS? |
I have nothing against plain JS (I actually prefer it over jQuery), but touching clean and working code (the one for Jasmine) is never a good idea for someone (me) which doesn't know well the codebase, expecially when there are no tests for the changed feature... Anyway I did it with plain JS (noticing only at the end that a |
Hey folks,
I noticed
toBeVisible
matcher ignorehidden
attribute.It may be a good idea to check that too.
The text was updated successfully, but these errors were encountered: