window-resizeto
Version:
A window.resizeTo polyfill for test environments like Jest & JSDOM
16 lines (13 loc) • 427 B
JavaScript
function resizeTo(windowObj, width, height) {
Object.assign(windowObj, {
innerWidth: width,
innerHeight: height,
outerWidth: width,
outerHeight: height
}).dispatchEvent(new windowObj.Event('resize'));
}
// we don't check `if (!('resizeTo' in window))` first because JSDOM sets it to
window.resizeTo = function (width, height) {
resizeTo(this, width, height);
};
//# sourceMappingURL=polyfill.esm.js.map