Skip to content

Return VueWrapper instance If element is binding Vue instance #687

Closed
@38elements

Description

@38elements

What problem does this feature solve?

Currently, using CSS Selector, the element binding Vue instance is wrapped by Wrapper.
Using CSS Selector, the element binding Vue instance is wrapped by VueWrapper.
I think it might be necessary and obvious.

What does the proposed API look like?

component.vue

<template>
  <div class="foo" />
</template>

<script>
  export default {
    name: 'component'
  }
</script>

component-with-child.vue

<template>
  <div>
    <span>
      <child-component/>
      <div class="foo" />
      <child-component/>
    </span>
  </div>
</template>

<script>
  import ChildComponent from './component.vue'
  export default{
    name: 'component-with-child',
    components: {
      ChildComponent
    }
  }
</script>
import ComponentWithChild from '~resources/components/component-with-child.vue'
const wrapper = mount(ComponentWithChild);
const wrappers = wrapper.findAll('.foo')
expect(wrappers.at(0)).to.be.an.instanceOf(VueWrapper)
expect(wrappers.at(1)).to.be.an.instanceOf(Wrapper)
expect(wrappers.at(2)).to.be.an.instanceOf(VueWrapper)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions