-
Notifications
You must be signed in to change notification settings - Fork 668
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
Allow mount method to attach to specific HTML Element rather than generically attaching to the document #1487
Comments
Could you explain a bit what use cases will this solve? |
Let's say your Vue app exists within the context of a larger page. Only one part of your app is Vue. Another part is just static HTML, another part is react. Does it render correctly? I can verify this by just rendering via Vue and taking screenshots with puppeteer, but then I'm not able to use all of the convenience methods of Vue test utils. |
Another use case could be to test that hydration of a SSR paged works successfully. I can't use Vue test utils, as far as I know, to hydrate markup. That could be very beneficial, and, potentially, part of this API. |
This allows for users to specify where in the document their component should attach, either through a CSS selector string or a provided HTMLElement. This option is passed through directly to the vm.$mount method that is called as part of mount.js feat vuejs#1487
This makes sense to me. There is a PR; just need to docs to be updated @jnields and we can merge it up. |
fixed in #1492 |
What problem does this feature solve?
This allows the developer to attach a component within the context of a page, and potentially allows for more integrated testing, e.g. via puppeteer.
What does the proposed API look like?
Currently you offer this option in the API:
https://vue-test-utils.vuejs.org/api/options.html#attachtodocument
I believe it should be expanded to allow specification of where in the document it is attached.
This is roughly equivalent to the API used by Enzyme
https://enzymejs.github.io/enzyme/docs/api/mount.html
The text was updated successfully, but these errors were encountered: