Skip to content
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

toBeVisible-matcher does not work with jest #280

Closed
askarby opened this issue Feb 27, 2020 · 3 comments · Fixed by #281
Closed

toBeVisible-matcher does not work with jest #280

askarby opened this issue Feb 27, 2020 · 3 comments · Fixed by #281

Comments

@askarby
Copy link
Contributor

askarby commented Feb 27, 2020

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Visible elements are reported as "not being visible" by the toBeVisible-matcher, when spectator is used within jest (using the @ngneat/spectator/jestdependency).

Expected behavior

Visible elements should be reported as "being visible"

Minimal reproduction of the problem with instructions

A minimal reproduction repository can be found here: https://github.com/askarby/jest-tobevisible-bug

What is the motivation / use case for changing the behavior?

You would expect the matcher to work, used in jest or jasmine alike.

Environment


Angular version: 9.0.3

Browser:


- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
- [x] jsdom

For Tooling issues:

  • Node version: 10.17.0
  • Platform: Mac

Additional Details

The problem seems to be related to the issue: jsdom/jsdom#135 (regarding jsdom not being able to determine offsetHeight, offsetWidth, etc (which is used from within the toBeVisible-matcher).

@NetanelBasal
Copy link
Member

I'm not sure what you mean. Both Jasmine and Jest are using the same toBeVisible matcher.

@askarby
Copy link
Contributor Author

askarby commented Feb 27, 2020

@NetanelBasal

True.... but the implementation of toBeVisible only works (as intended) with jasmine... it fails when used with jest!

Visible elements are reported as being hidden (not visible)

NOTICE: I updated the issue report to be more concise.

@NetanelBasal
Copy link
Member

Feel free to investigate and create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants