Skip to content

Allow mount method to attach to specific HTML Element rather than generically attaching to the document #1487

Closed
@jnields

Description

@jnields

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.

const wrapper = mount(Component, {
  attachTo: document.getElementById('app'),
})

This is roughly equivalent to the API used by Enzyme
https://enzymejs.github.io/enzyme/docs/api/mount.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions