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

fix: return wrapper error from DOMWrapper ctor if element is nullish #1996

Merged
merged 1 commit into from Mar 9, 2023

Conversation

ascott18
Copy link
Contributor

@ascott18 ascott18 commented Mar 6, 2023

fixes #1984

Rationale: Rather than overriding exists on DomWrapper, I elected to instead return a wrapper error from DomWrapper's ctor if the provided element is nullish.

This allows the ctor of DomWrapper to be changed to allow null | undefined without having to propagate null | undefined downwards into BaseWrapper.constructor, BaseWrapper.wrapperElement, BaseWrapper.element, and WrapperLike.element, a change that would be significantly breaking and cause consumers of test-utils to have to add non-null assertions all over the place.

This also simplifies some other uses cases, like for example the one I changed in plugins.md.

@netlify
Copy link

netlify bot commented Mar 6, 2023

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit b37e611
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-docs/deploys/6406554be561f80008d0af17
😎 Deploy Preview https://deploy-preview-1996--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@cexbrayat cexbrayat left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@lmiller1990 lmiller1990 merged commit 3207deb into vuejs:main Mar 9, 2023
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.

Feature request: Make it easier to wrap an arbitrary element/selector
3 participants