@trinitymirrordigital/dragonfly-jest-config
Version:
Jest config for dragonfly projects
22 lines (18 loc) • 609 B
JavaScript
/* eslint-disable no-underscore-dangle */
Object.defineProperty(window.HTMLElement.prototype, 'clientWidth', {
get() {
return this._MockClientWidth || parseInt(this.style.width, 10) || 0;
},
});
Object.defineProperty(window.HTMLElement.prototype, 'clientHeight', {
get() {
return this._MockClientHeight || parseInt(this.style.height, 10) || 0;
},
});
Object.assign(window.HTMLElement.prototype, {
getBoundingClientRect() {
return this._MockClientRect;
},
_MockClientRect: { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 },
});
/* eslint-enable no-underscore-dangle */