mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
de0ee53cf0
Co-authored-by: 三咲智子 <sxzz@sxzz.moe>
65 lines
1.2 KiB
TypeScript
65 lines
1.2 KiB
TypeScript
import { nextTick } from 'vue'
|
|
import { mount as _mount } from '@vue/test-utils'
|
|
import { vi } from 'vitest'
|
|
|
|
vi.mock('lodash-unified', async () => {
|
|
return {
|
|
...((await vi.importActual('lodash-unified')) as Record<string, any>),
|
|
debounce: vi.fn((fn) => {
|
|
fn.cancel = vi.fn()
|
|
fn.flush = vi.fn()
|
|
return fn
|
|
}),
|
|
}
|
|
})
|
|
|
|
export async function doubleWait() {
|
|
await nextTick()
|
|
await nextTick()
|
|
}
|
|
|
|
export const mount = (opt: any) =>
|
|
_mount<any>(opt, {
|
|
attachTo: 'body',
|
|
})
|
|
|
|
export function getTestData() {
|
|
return [
|
|
{
|
|
id: 1,
|
|
name: 'Toy Story',
|
|
release: '1995-11-22',
|
|
director: 'John Lasseter',
|
|
runtime: 80,
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "A Bug's Life",
|
|
release: '1998-11-25',
|
|
director: 'John Lasseter',
|
|
runtime: 95,
|
|
},
|
|
{
|
|
id: 3,
|
|
name: 'Toy Story 2',
|
|
release: '1999-11-24',
|
|
director: 'John Lasseter',
|
|
runtime: 92,
|
|
},
|
|
{
|
|
id: 4,
|
|
name: 'Monsters, Inc.',
|
|
release: '2001-11-2',
|
|
director: 'Peter Docter',
|
|
runtime: 92,
|
|
},
|
|
{
|
|
id: 5,
|
|
name: 'Finding Nemo',
|
|
release: '2003-5-30',
|
|
director: 'Andrew Stanton',
|
|
runtime: 100,
|
|
},
|
|
]
|
|
}
|