2022-06-22 08:04:42 +08:00
|
|
|
// @ts-nocheck
|
2021-04-16 11:18:39 +08:00
|
|
|
import defineGetter from '@element-plus/test-utils/define-getter'
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const clientWidth = defineGetter(
|
|
|
|
HTMLElement.prototype,
|
|
|
|
'clientWidth',
|
2021-09-04 19:29:28 +08:00
|
|
|
function () {
|
2022-03-08 14:03:32 +08:00
|
|
|
return Number.parseInt(this.style.width, 10) || 0
|
2021-04-16 11:18:39 +08:00
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
0
|
2021-04-16 11:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const clientHeight = defineGetter(
|
|
|
|
HTMLElement.prototype,
|
|
|
|
'clientHeight',
|
2021-09-04 19:29:28 +08:00
|
|
|
function () {
|
2022-03-08 14:03:32 +08:00
|
|
|
return Number.parseInt(this.style.height, 10) || 0
|
2021-04-16 11:18:39 +08:00
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
0
|
2021-04-16 11:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const scrollHeight = defineGetter(
|
|
|
|
HTMLElement.prototype,
|
|
|
|
'scrollHeight',
|
2022-03-08 14:03:32 +08:00
|
|
|
() => {
|
2021-04-16 11:18:39 +08:00
|
|
|
return Number.MAX_SAFE_INTEGER
|
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
0
|
2021-04-16 11:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const scrollWidth = defineGetter(
|
|
|
|
HTMLElement.prototype,
|
|
|
|
'scrollWidth',
|
2022-03-08 14:03:32 +08:00
|
|
|
() => {
|
2021-04-16 11:18:39 +08:00
|
|
|
return Number.MAX_SAFE_INTEGER
|
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
0
|
2021-04-16 11:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// clean up function
|
|
|
|
return () => {
|
|
|
|
clientWidth()
|
|
|
|
clientHeight()
|
|
|
|
scrollHeight()
|
|
|
|
scrollWidth()
|
|
|
|
}
|
|
|
|
}
|