Skip to content

Commit

Permalink
test: add repro for #1973
Browse files Browse the repository at this point in the history
  • Loading branch information
cexbrayat committed Apr 15, 2023
1 parent d3e50f9 commit be8adca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/components/DefinePropsAndDefineEmits.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div :class="placement">
<slot />
</div>
</template>

<script lang="ts" setup>
defineProps<{
placement: 'start' | 'end' | 'top' | 'bottom';
}>();
defineEmits<{
(e: 'update', value: string): void;
}>();
</script>
12 changes: 12 additions & 0 deletions tests/mount.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { defineComponent } from 'vue'
import { mount } from '../src'
import DefinePropsAndDefineEmits from './components/DefinePropsAndDefineEmits.vue'
import HelloFromVitestPlayground from './components/HelloFromVitestPlayground.vue'

describe('mount: general tests', () => {
Expand Down Expand Up @@ -32,4 +33,15 @@ describe('mount: general tests', () => {

expect(spy).not.toHaveBeenCalled()
})

it('should mount a component with props, emits and slot (#1973)', () => {
const wrapper = mount(DefinePropsAndDefineEmits, {
props: {
placement: 'end'
},
slots: { default: 'Hello' }
})
expect(wrapper.get('div').text()).toContain('Hello')
expect(wrapper.get('div').classes()).toContain('end')
})
})

0 comments on commit be8adca

Please sign in to comment.