mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
e9e56d5938
* chore: remove unused ts-node * chore: upgrade lodash * chore: upgrade eslint * perf: remove side effects in computed * refactor: follow eslint rules * chore: remove vue-template-compiler * style: enhance eslint format rule * style: format code
27 lines
576 B
TypeScript
27 lines
576 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
|