UNPKG

@helpscout/cyan

Version:

Cypress-like Testing for React + JSDOM

82 lines (73 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var setupJSDOM = function () { beforeEach(function () { /** * window */ window.IntersectionObserver = function () { return { disconnect: function disconnect() { return null; }, observe: function observe() { return null; }, takeRecords: function takeRecords() { return null; }, unobserve: function unobserve() { return null; } }; }; window.getSelection = function () { return { addRange: function addRange() { return {}; }, removeAllRanges: function removeAllRanges() { return {}; } }; }; window.scrollTo = function () { return null; }; /** * document */ document.createRange = function () { return { setStart: function setStart() {}, setEnd: function setEnd() {}, selectNodeContents: function selectNodeContents() {}, commonAncestorContainer: { nodeName: 'BODY', ownerDocument: document } }; }; document.execCommand = function () { return null; }; }); afterEach(function () { /** * window */ window.IntersectionObserver = undefined; window.getSelection = undefined; window.scrollTo = undefined; /** * document */ document.createRange = undefined; document.execCommand = undefined; }); }; var _default = setupJSDOM; exports.default = _default;