mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 17:31:02 +08:00
11 lines
329 B
TypeScript
11 lines
329 B
TypeScript
import { sleep } from '@element-plus/test-utils'
|
|
|
|
const makeScroll = async (dom: Element, name: 'scrollTop' | 'scrollLeft', offset: number) => {
|
|
dom[name] = offset
|
|
dom.dispatchEvent(new CustomEvent('scroll'))
|
|
// must use setTimeout instead of nextTick to wait dom change
|
|
return await sleep()
|
|
}
|
|
|
|
export default makeScroll
|