Skip to content

Find should return root node if it's a match #1464

Open
@hjJunior

Description

@hjJunior

Version

1.0.0-beta.32

Reproduction link

https://codesandbox.io/s/clever-bush-v4p5i

Steps to reproduce

  1. Create a child component which should emit an event
  2. Create a wrapper component which will render directly only the child component
  3. Set a listener for this created event on the wrapper

Then go to the tests

  1. Use shallowMount to create the wrapper
  2. Stub the event handler function using wrapper.setMethods
  3. Find and emit the event wrapper.find('Child-stub').vm.$emit('your-event')
  4. Assert if event handler function have been called

What is expected?

It's expected the handler function be called

What is actually happening?

It looks when we create a Wrapper component which renders directly a Child component, and then, when the child component emits an event, the wrapper won't call the handle function


On the reproduction link, there are two Wrappers

  • Wrapper doesn't work
  • Wrapper2 works, because I moved my ChildComponent to an <div>

Maybe this can be related with #650 (comment)

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