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 () {
|
2021-04-16 11:18:39 +08:00
|
|
|
return parseInt(this.style.width, 10) || 0
|
|
|
|
},
|
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 () {
|
2021-04-16 11:18:39 +08:00
|
|
|
return parseInt(this.style.height, 10) || 0
|
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
0
|
2021-04-16 11:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const scrollHeight = defineGetter(
|
|
|
|
HTMLElement.prototype,
|
|
|
|
'scrollHeight',
|
2021-09-04 19:29:28 +08:00
|
|
|
function () {
|
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',
|
2021-09-04 19:29:28 +08:00
|
|
|
function () {
|
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()
|
|
|
|
}
|
|
|
|
}
|