0

Component:

<template>
  <MyComponent>
    <div class="in-slot">Hello world</div>
  </MyComponent>
</template>

How to get access to div.in-slot and test his text?

DenniLa2
  • 381
  • 2
  • 14

1 Answers1

1

If we suppose that you imported the parent component as MyParentComponent in your test file, this should work:

const wrapper = mount(MyParentComponent, {options})
expect(wrapper.find('.in-slot').text()).toBe('Hello world')
Máté Wiszt
  • 396
  • 2
  • 13