mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
27 lines
575 B
TypeScript
27 lines
575 B
TypeScript
import { mount } from '@vue/test-utils'
|
|
import { merge } from 'lodash'
|
|
|
|
const makeMount = <C,O, E>(element: C, defaultOptions: O) => {
|
|
return (props: (E | O) | (E & O)= {} as E) => mount(element, merge({}, defaultOptions, props))
|
|
}
|
|
|
|
interface Options {
|
|
data?: () => {
|
|
[key: string]: any
|
|
}
|
|
methods?: {
|
|
[key: string]: (...args) => any
|
|
}
|
|
}
|
|
|
|
export const makeMountFunc = defaultOptions => {
|
|
return (template: string, options: Options) => {
|
|
return mount({
|
|
...merge({}, defaultOptions, options),
|
|
template,
|
|
})
|
|
}
|
|
}
|
|
|
|
export default makeMount
|