mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
55348b30b6
* style: use prettier * style: just prettier format, no code changes * style: eslint fix object-shorthand, prefer-const * style: fix no-void * style: no-console
28 lines
583 B
TypeScript
28 lines
583 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
|