ray-template/__test__/utils/createRefElement.tsx
2024-03-23 11:25:28 +08:00

25 lines
444 B
TypeScript

import { mount } from '@vue/test-utils'
import type { Slot } from 'vue'
const createRefElement = (slots?: Record<string, Function>) => {
const wrapper = mount(
defineComponent({
setup() {
const domRef = ref<HTMLElement>()
return {
domRef,
}
},
render() {
return <div ref="domRef">{{ ...slots }}</div>
},
}),
)
return wrapper
}
export default createRefElement