mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
fix(test-utils): fix type error (#8780)
* fix(test-utils): fix type error * chore: update * chore: update
This commit is contained in:
parent
4b0b051c53
commit
d45c2b95b2
@ -1,4 +1,3 @@
|
|||||||
// @ts-nocheck
|
|
||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import { merge } from 'lodash'
|
import { merge } from 'lodash'
|
||||||
|
|
||||||
@ -9,14 +8,16 @@ const makeMount = <C, O, E>(element: C, defaultOptions: O) => {
|
|||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
data?: () => {
|
data?: () => {
|
||||||
[key: string]: any
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
methods?: {
|
methods?: {
|
||||||
[key: string]: (...args) => any
|
[key: string]: (...args: unknown[]) => any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeMountFunc = (defaultOptions) => {
|
export const makeMountFunc = <T extends Record<string, unknown>>(
|
||||||
|
defaultOptions: T
|
||||||
|
) => {
|
||||||
return (template: string, options: Options) => {
|
return (template: string, options: Options) => {
|
||||||
return mount({
|
return mount({
|
||||||
...merge({}, defaultOptions, options),
|
...merge({}, defaultOptions, options),
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// @ts-nocheck
|
|
||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
import { afterAll, beforeAll } from 'vitest'
|
import { afterAll, beforeAll } from 'vitest'
|
||||||
|
|
||||||
@ -20,6 +19,6 @@ export function mockImageEvent() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
Object.defineProperty(imageProto, 'src', oldDescriptor)
|
Object.defineProperty(imageProto, 'src', oldDescriptor!)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user