Skip to content

Return VueWrapper instance If element is binding Vue instance #687

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

Closed
38elements opened this issue Jun 6, 2018 · 3 comments
Closed

Return VueWrapper instance If element is binding Vue instance #687

38elements opened this issue Jun 6, 2018 · 3 comments

Comments

@38elements
Copy link
Contributor

38elements commented Jun 6, 2018

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)
@38elements 38elements changed the title Return VueWrapper If element is binding Vue instance Return VueWrapper instance If element is binding Vue instance Jun 6, 2018
@eddyerburgh
Copy link
Member

Yes I think this is a good idea. This would address #677.

Would you like to implement it?

@38elements
Copy link
Contributor Author

I will send a pull request widthin 7 days.

@38elements
Copy link
Contributor Author

I am sorry.
I got a work to do,
I will send a pull request within 7 days from today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants