Skip to content

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

Merged
lmiller1990 merged 2 commits into
vuejs:devfrom
IGx89:feature/computed-style-check
Oct 31, 2022
Merged

feat: make isVisible more comprehensive (backport from v2) (fix #1456)#2013
lmiller1990 merged 2 commits into
vuejs:devfrom
IGx89:feature/computed-style-check

Conversation

@IGx89

@IGx89 IGx89 commented Sep 30, 2022

Copy link
Copy Markdown
Contributor

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

netlify Bot commented Sep 30, 2022

Copy link
Copy Markdown

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

IGx89 commented Oct 5, 2022

Copy link
Copy Markdown
Contributor Author

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

@lmiller1990 lmiller1990 left a comment

Copy link
Copy Markdown
Member

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.

Comment thread packages/shared/is-visible.js
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