Skip to content

Commit

Permalink
chore: add test for stubbing component inside slot for shallow
Browse files Browse the repository at this point in the history
  • Loading branch information
xanf committed Jun 28, 2021
1 parent ffe05e2 commit c781c3d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/shallowMount.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ describe('shallowMount', () => {
expect(wrapper.find('.slot-content').exists()).toBe(true)
})

it('correctly stubs components inside slot', () => {
const ComponentWithSlot = defineComponent({
template: '<div><slot></slot></div>'
})

const Foo = defineComponent({
name: 'Foo',
template: '<div class="unstubbed-foo">OK</div>'
})

const wrapper = shallowMount(ComponentWithSlot, {
global: {
components: { Foo }
},
slots: {
default: '<Foo />'
}
})

expect(wrapper.find('.unstubbed-foo').exists()).toBe(false)
})

it('stubs all components, but allows providing custom stub', () => {
const wrapper = mount(ComponentWithChildren, {
shallow: true,
Expand Down

0 comments on commit c781c3d

Please sign in to comment.