Skip to content

Commit be8adca

Browse files
committed
test: add repro for #1973
1 parent d3e50f9 commit be8adca

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div :class="placement">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script lang="ts" setup>
8+
defineProps<{
9+
placement: 'start' | 'end' | 'top' | 'bottom';
10+
}>();
11+
12+
defineEmits<{
13+
(e: 'update', value: string): void;
14+
}>();
15+
</script>

tests/mount.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it, vi } from 'vitest'
22
import { defineComponent } from 'vue'
33
import { mount } from '../src'
4+
import DefinePropsAndDefineEmits from './components/DefinePropsAndDefineEmits.vue'
45
import HelloFromVitestPlayground from './components/HelloFromVitestPlayground.vue'
56

67
describe('mount: general tests', () => {
@@ -32,4 +33,15 @@ describe('mount: general tests', () => {
3233

3334
expect(spy).not.toHaveBeenCalled()
3435
})
36+
37+
it('should mount a component with props, emits and slot (#1973)', () => {
38+
const wrapper = mount(DefinePropsAndDefineEmits, {
39+
props: {
40+
placement: 'end'
41+
},
42+
slots: { default: 'Hello' }
43+
})
44+
expect(wrapper.get('div').text()).toContain('Hello')
45+
expect(wrapper.get('div').classes()).toContain('end')
46+
})
3547
})

0 commit comments

Comments
 (0)