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

feat: make isVisible more comprehensive (backport from v2) (fix #1456) #2013

Merged
merged 2 commits into from
Oct 31, 2022

Conversation

IGx89
Copy link
Contributor

@IGx89 IGx89 commented Sep 30, 2022

Enhancement to isVisible to take all styling into account. This is a backport of vuejs/test-utils#454.

One notable change between this and the version in v2 is that it only works on elements that are part of the DOM (part of an attached tree). This is due to getComputedStyle being defined as only working in that scenario, per https://lists.w3.org/Archives/Public/www-style/2018May/0031.html. Chrome and Safari match the spec, but other browsers (including jsdom) allow it to still work. v2 only runs under jsdom while v1 can run under Chrome, which is why I had to narrow it here to only work when the element is part of the DOM. I imagine someday jsdom will implement that behavior as well, in which case v2+ will need to function this way as well.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

CC @lmiller1990

@netlify
Copy link

netlify bot commented Sep 30, 2022

Deploy Preview for vue-test-utils-v1 failed.

Name Link
🔨 Latest commit 6676c3e
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-v1/deploys/634d61de3ec98800081a27d9

@IGx89
Copy link
Contributor Author

IGx89 commented Oct 5, 2022

@lmiller1990, just making sure this is still on your radar

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question. Will reply a bit slowly, sorry about that.

packages/shared/is-visible.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants