mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
424
web/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js
generated
vendored
Normal file
424
web/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,424 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var _extends = require('@babel/runtime/helpers/extends');
|
||||
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
||||
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var dom = require('@testing-library/dom');
|
||||
var testUtils = require('react-dom/test-utils');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return e[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n['default'] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
||||
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
||||
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
||||
var testUtils__namespace = /*#__PURE__*/_interopNamespace(testUtils);
|
||||
|
||||
var reactAct = testUtils__namespace.act;
|
||||
var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0
|
||||
// so for versions that don't have act from test utils
|
||||
// we do this little polyfill. No warnings, but it's
|
||||
// better than nothing.
|
||||
|
||||
function actPolyfill(cb) {
|
||||
ReactDOM__default['default'].unstable_batchedUpdates(cb);
|
||||
ReactDOM__default['default'].render( /*#__PURE__*/React__namespace.createElement("div", null), document.createElement('div'));
|
||||
}
|
||||
|
||||
var act = reactAct || actPolyfill;
|
||||
var youHaveBeenWarned = false;
|
||||
var isAsyncActSupported = null;
|
||||
|
||||
function asyncAct(cb) {
|
||||
if (actSupported === true) {
|
||||
if (isAsyncActSupported === null) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// patch console.error here
|
||||
var originalConsoleError = console.error;
|
||||
|
||||
console.error = function error() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
/* if console.error fired *with that specific message* */
|
||||
|
||||
/* istanbul ignore next */
|
||||
var firstArgIsString = typeof args[0] === 'string';
|
||||
|
||||
if (firstArgIsString && args[0].indexOf('Warning: Do not await the result of calling ReactTestUtils.act') === 0) {
|
||||
// v16.8.6
|
||||
isAsyncActSupported = false;
|
||||
} else if (firstArgIsString && args[0].indexOf('Warning: The callback passed to ReactTestUtils.act(...) function must not return anything') === 0) ; else {
|
||||
originalConsoleError.apply(console, args);
|
||||
}
|
||||
};
|
||||
|
||||
var cbReturn, result;
|
||||
|
||||
try {
|
||||
result = reactAct(function () {
|
||||
cbReturn = cb();
|
||||
return cbReturn;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error = originalConsoleError;
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
result.then(function () {
|
||||
console.error = originalConsoleError; // if it got here, it means async act is supported
|
||||
|
||||
isAsyncActSupported = true;
|
||||
resolve();
|
||||
}, function (err) {
|
||||
console.error = originalConsoleError;
|
||||
isAsyncActSupported = true;
|
||||
reject(err);
|
||||
}); // 16.8.6's act().then() doesn't call a resolve handler, so we need to manually flush here, sigh
|
||||
|
||||
if (isAsyncActSupported === false) {
|
||||
console.error = originalConsoleError;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (!youHaveBeenWarned) {
|
||||
// if act is supported and async act isn't and they're trying to use async
|
||||
// act, then they need to upgrade from 16.8 to 16.9.
|
||||
// This is a seamless upgrade, so we'll add a warning
|
||||
console.error("It looks like you're using a version of react-dom that supports the \"act\" function, but not an awaitable version of \"act\" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.");
|
||||
youHaveBeenWarned = true;
|
||||
}
|
||||
|
||||
cbReturn.then(function () {
|
||||
// a faux-version.
|
||||
// todo - copy https://github.com/facebook/react/blob/master/packages/shared/enqueueTask.js
|
||||
Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
resolve();
|
||||
});
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
} else if (isAsyncActSupported === false) {
|
||||
// use the polyfill directly
|
||||
var _result;
|
||||
|
||||
act(function () {
|
||||
_result = cb();
|
||||
});
|
||||
return _result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
} // all good! regular act
|
||||
|
||||
|
||||
return act(cb);
|
||||
} // use the polyfill
|
||||
|
||||
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
}
|
||||
/* eslint no-console:0 */
|
||||
|
||||
// dom-testing-library's version of fireEvent. The reason
|
||||
// we make this distinction however is because we have
|
||||
// a few extra events that work a bit differently
|
||||
|
||||
var fireEvent = function fireEvent() {
|
||||
return dom.fireEvent.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
Object.keys(dom.fireEvent).forEach(function (key) {
|
||||
fireEvent[key] = function () {
|
||||
return dom.fireEvent[key].apply(dom.fireEvent, arguments);
|
||||
};
|
||||
}); // React event system tracks native mouseOver/mouseOut events for
|
||||
// running onMouseEnter/onMouseLeave handlers
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
|
||||
|
||||
var mouseEnter = fireEvent.mouseEnter;
|
||||
var mouseLeave = fireEvent.mouseLeave;
|
||||
|
||||
fireEvent.mouseEnter = function () {
|
||||
mouseEnter.apply(void 0, arguments);
|
||||
return fireEvent.mouseOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.mouseLeave = function () {
|
||||
mouseLeave.apply(void 0, arguments);
|
||||
return fireEvent.mouseOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var pointerEnter = fireEvent.pointerEnter;
|
||||
var pointerLeave = fireEvent.pointerLeave;
|
||||
|
||||
fireEvent.pointerEnter = function () {
|
||||
pointerEnter.apply(void 0, arguments);
|
||||
return fireEvent.pointerOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.pointerLeave = function () {
|
||||
pointerLeave.apply(void 0, arguments);
|
||||
return fireEvent.pointerOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var select = fireEvent.select;
|
||||
|
||||
fireEvent.select = function (node, init) {
|
||||
select(node, init); // React tracks this event only on focused inputs
|
||||
|
||||
node.focus(); // React creates this event when one of the following native events happens
|
||||
// - contextMenu
|
||||
// - mouseUp
|
||||
// - dragEnd
|
||||
// - keyUp
|
||||
// - keyDown
|
||||
// so we can use any here
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
|
||||
|
||||
fireEvent.keyUp(node, init);
|
||||
}; // React event system tracks native focusout/focusin events for
|
||||
// running blur/focus handlers
|
||||
// @link https://github.com/facebook/react/pull/19186
|
||||
|
||||
|
||||
var blur = fireEvent.blur;
|
||||
var focus = fireEvent.focus;
|
||||
|
||||
fireEvent.blur = function () {
|
||||
fireEvent.focusOut.apply(fireEvent, arguments);
|
||||
return blur.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
fireEvent.focus = function () {
|
||||
fireEvent.focusIn.apply(fireEvent, arguments);
|
||||
return focus.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
dom.configure({
|
||||
asyncWrapper: function () {
|
||||
var _asyncWrapper = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(cb) {
|
||||
var result;
|
||||
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.next = 2;
|
||||
return asyncAct( /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
||||
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return cb();
|
||||
|
||||
case 2:
|
||||
result = _context.sent;
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee);
|
||||
})));
|
||||
|
||||
case 2:
|
||||
return _context2.abrupt("return", result);
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
|
||||
function asyncWrapper(_x) {
|
||||
return _asyncWrapper.apply(this, arguments);
|
||||
}
|
||||
|
||||
return asyncWrapper;
|
||||
}(),
|
||||
eventWrapper: function eventWrapper(cb) {
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
var mountedContainers = new Set();
|
||||
|
||||
function render(ui, _temp) {
|
||||
var _ref2 = _temp === void 0 ? {} : _temp,
|
||||
container = _ref2.container,
|
||||
_ref2$baseElement = _ref2.baseElement,
|
||||
baseElement = _ref2$baseElement === void 0 ? container : _ref2$baseElement,
|
||||
queries = _ref2.queries,
|
||||
_ref2$hydrate = _ref2.hydrate,
|
||||
hydrate = _ref2$hydrate === void 0 ? false : _ref2$hydrate,
|
||||
WrapperComponent = _ref2.wrapper;
|
||||
|
||||
if (!baseElement) {
|
||||
// default to document.body instead of documentElement to avoid output of potentially-large
|
||||
// head elements (such as JSS style blocks) in debug output
|
||||
baseElement = document.body;
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = baseElement.appendChild(document.createElement('div'));
|
||||
} // we'll add it to the mounted containers regardless of whether it's actually
|
||||
// added to document.body so the cleanup method works regardless of whether
|
||||
// they're passing us a custom container or not.
|
||||
|
||||
|
||||
mountedContainers.add(container);
|
||||
|
||||
var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) {
|
||||
return WrapperComponent ? /*#__PURE__*/React__namespace.createElement(WrapperComponent, null, innerElement) : innerElement;
|
||||
};
|
||||
|
||||
act(function () {
|
||||
if (hydrate) {
|
||||
ReactDOM__default['default'].hydrate(wrapUiIfNeeded(ui), container);
|
||||
} else {
|
||||
ReactDOM__default['default'].render(wrapUiIfNeeded(ui), container);
|
||||
}
|
||||
});
|
||||
return _extends__default['default']({
|
||||
container: container,
|
||||
baseElement: baseElement,
|
||||
debug: function debug(el, maxLength, options) {
|
||||
if (el === void 0) {
|
||||
el = baseElement;
|
||||
}
|
||||
|
||||
return Array.isArray(el) ? // eslint-disable-next-line no-console
|
||||
el.forEach(function (e) {
|
||||
return console.log(dom.prettyDOM(e, maxLength, options));
|
||||
}) : // eslint-disable-next-line no-console,
|
||||
console.log(dom.prettyDOM(el, maxLength, options));
|
||||
},
|
||||
unmount: function unmount() {
|
||||
act(function () {
|
||||
ReactDOM__default['default'].unmountComponentAtNode(container);
|
||||
});
|
||||
},
|
||||
rerender: function rerender(rerenderUi) {
|
||||
render(wrapUiIfNeeded(rerenderUi), {
|
||||
container: container,
|
||||
baseElement: baseElement
|
||||
}); // Intentionally do not return anything to avoid unnecessarily complicating the API.
|
||||
// folks can use all the same utilities we return in the first place that are bound to the container
|
||||
},
|
||||
asFragment: function asFragment() {
|
||||
/* istanbul ignore else (old jsdom limitation) */
|
||||
if (typeof document.createRange === 'function') {
|
||||
return document.createRange().createContextualFragment(container.innerHTML);
|
||||
} else {
|
||||
var template = document.createElement('template');
|
||||
template.innerHTML = container.innerHTML;
|
||||
return template.content;
|
||||
}
|
||||
}
|
||||
}, dom.getQueriesForElement(baseElement, queries));
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
mountedContainers.forEach(cleanupAtContainer);
|
||||
} // maybe one day we'll expose this (perhaps even as a utility returned by render).
|
||||
// but let's wait until someone asks for it.
|
||||
|
||||
|
||||
function cleanupAtContainer(container) {
|
||||
act(function () {
|
||||
ReactDOM__default['default'].unmountComponentAtNode(container);
|
||||
});
|
||||
|
||||
if (container.parentNode === document.body) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
|
||||
mountedContainers.delete(container);
|
||||
} // just re-export everything from dom-testing-library
|
||||
// thing for people using react-dom@16.8.0. Anyone else doesn't need it and
|
||||
// people should just upgrade anyway.
|
||||
|
||||
/* eslint func-name-matching:0 */
|
||||
|
||||
var _process$env;
|
||||
// or teardown then we'll automatically run cleanup afterEach test
|
||||
// this ensures that tests run in isolation from each other
|
||||
// if you don't like this then either import the `pure` module
|
||||
// or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'.
|
||||
|
||||
if (typeof process === "undefined" || !((_process$env = process.env) != null && _process$env.RTL_SKIP_AUTO_CLEANUP)) {
|
||||
// ignore teardown() in code coverage because Jest does not support it
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof afterEach === 'function') {
|
||||
afterEach(function () {
|
||||
cleanup();
|
||||
});
|
||||
} else if (typeof teardown === 'function') {
|
||||
// Block is guarded by `typeof` check.
|
||||
// eslint does not support `typeof` guards.
|
||||
// eslint-disable-next-line no-undef
|
||||
teardown(function () {
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.act = act;
|
||||
exports.cleanup = cleanup;
|
||||
exports.fireEvent = fireEvent;
|
||||
exports.render = render;
|
||||
Object.keys(dom).forEach(function (k) {
|
||||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return dom[k];
|
||||
}
|
||||
});
|
||||
});
|
381
web/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
generated
vendored
Normal file
381
web/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
generated
vendored
Normal file
|
@ -0,0 +1,381 @@
|
|||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
|
||||
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
||||
import * as React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { fireEvent as fireEvent$1, configure, prettyDOM, getQueriesForElement } from '@testing-library/dom';
|
||||
export * from '@testing-library/dom';
|
||||
import * as testUtils from 'react-dom/test-utils';
|
||||
|
||||
var reactAct = testUtils.act;
|
||||
var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0
|
||||
// so for versions that don't have act from test utils
|
||||
// we do this little polyfill. No warnings, but it's
|
||||
// better than nothing.
|
||||
|
||||
function actPolyfill(cb) {
|
||||
ReactDOM.unstable_batchedUpdates(cb);
|
||||
ReactDOM.render( /*#__PURE__*/React.createElement("div", null), document.createElement('div'));
|
||||
}
|
||||
|
||||
var act = reactAct || actPolyfill;
|
||||
var youHaveBeenWarned = false;
|
||||
var isAsyncActSupported = null;
|
||||
|
||||
function asyncAct(cb) {
|
||||
if (actSupported === true) {
|
||||
if (isAsyncActSupported === null) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// patch console.error here
|
||||
var originalConsoleError = console.error;
|
||||
|
||||
console.error = function error() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
/* if console.error fired *with that specific message* */
|
||||
|
||||
/* istanbul ignore next */
|
||||
var firstArgIsString = typeof args[0] === 'string';
|
||||
|
||||
if (firstArgIsString && args[0].indexOf('Warning: Do not await the result of calling ReactTestUtils.act') === 0) {
|
||||
// v16.8.6
|
||||
isAsyncActSupported = false;
|
||||
} else if (firstArgIsString && args[0].indexOf('Warning: The callback passed to ReactTestUtils.act(...) function must not return anything') === 0) ; else {
|
||||
originalConsoleError.apply(console, args);
|
||||
}
|
||||
};
|
||||
|
||||
var cbReturn, result;
|
||||
|
||||
try {
|
||||
result = reactAct(function () {
|
||||
cbReturn = cb();
|
||||
return cbReturn;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error = originalConsoleError;
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
result.then(function () {
|
||||
console.error = originalConsoleError; // if it got here, it means async act is supported
|
||||
|
||||
isAsyncActSupported = true;
|
||||
resolve();
|
||||
}, function (err) {
|
||||
console.error = originalConsoleError;
|
||||
isAsyncActSupported = true;
|
||||
reject(err);
|
||||
}); // 16.8.6's act().then() doesn't call a resolve handler, so we need to manually flush here, sigh
|
||||
|
||||
if (isAsyncActSupported === false) {
|
||||
console.error = originalConsoleError;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (!youHaveBeenWarned) {
|
||||
// if act is supported and async act isn't and they're trying to use async
|
||||
// act, then they need to upgrade from 16.8 to 16.9.
|
||||
// This is a seamless upgrade, so we'll add a warning
|
||||
console.error("It looks like you're using a version of react-dom that supports the \"act\" function, but not an awaitable version of \"act\" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.");
|
||||
youHaveBeenWarned = true;
|
||||
}
|
||||
|
||||
cbReturn.then(function () {
|
||||
// a faux-version.
|
||||
// todo - copy https://github.com/facebook/react/blob/master/packages/shared/enqueueTask.js
|
||||
Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
resolve();
|
||||
});
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
} else if (isAsyncActSupported === false) {
|
||||
// use the polyfill directly
|
||||
var _result;
|
||||
|
||||
act(function () {
|
||||
_result = cb();
|
||||
});
|
||||
return _result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
} // all good! regular act
|
||||
|
||||
|
||||
return act(cb);
|
||||
} // use the polyfill
|
||||
|
||||
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
}
|
||||
/* eslint no-console:0 */
|
||||
|
||||
// dom-testing-library's version of fireEvent. The reason
|
||||
// we make this distinction however is because we have
|
||||
// a few extra events that work a bit differently
|
||||
|
||||
var fireEvent = function fireEvent() {
|
||||
return fireEvent$1.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
Object.keys(fireEvent$1).forEach(function (key) {
|
||||
fireEvent[key] = function () {
|
||||
return fireEvent$1[key].apply(fireEvent$1, arguments);
|
||||
};
|
||||
}); // React event system tracks native mouseOver/mouseOut events for
|
||||
// running onMouseEnter/onMouseLeave handlers
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
|
||||
|
||||
var mouseEnter = fireEvent.mouseEnter;
|
||||
var mouseLeave = fireEvent.mouseLeave;
|
||||
|
||||
fireEvent.mouseEnter = function () {
|
||||
mouseEnter.apply(void 0, arguments);
|
||||
return fireEvent.mouseOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.mouseLeave = function () {
|
||||
mouseLeave.apply(void 0, arguments);
|
||||
return fireEvent.mouseOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var pointerEnter = fireEvent.pointerEnter;
|
||||
var pointerLeave = fireEvent.pointerLeave;
|
||||
|
||||
fireEvent.pointerEnter = function () {
|
||||
pointerEnter.apply(void 0, arguments);
|
||||
return fireEvent.pointerOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.pointerLeave = function () {
|
||||
pointerLeave.apply(void 0, arguments);
|
||||
return fireEvent.pointerOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var select = fireEvent.select;
|
||||
|
||||
fireEvent.select = function (node, init) {
|
||||
select(node, init); // React tracks this event only on focused inputs
|
||||
|
||||
node.focus(); // React creates this event when one of the following native events happens
|
||||
// - contextMenu
|
||||
// - mouseUp
|
||||
// - dragEnd
|
||||
// - keyUp
|
||||
// - keyDown
|
||||
// so we can use any here
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
|
||||
|
||||
fireEvent.keyUp(node, init);
|
||||
}; // React event system tracks native focusout/focusin events for
|
||||
// running blur/focus handlers
|
||||
// @link https://github.com/facebook/react/pull/19186
|
||||
|
||||
|
||||
var blur = fireEvent.blur;
|
||||
var focus = fireEvent.focus;
|
||||
|
||||
fireEvent.blur = function () {
|
||||
fireEvent.focusOut.apply(fireEvent, arguments);
|
||||
return blur.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
fireEvent.focus = function () {
|
||||
fireEvent.focusIn.apply(fireEvent, arguments);
|
||||
return focus.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
configure({
|
||||
asyncWrapper: function () {
|
||||
var _asyncWrapper = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cb) {
|
||||
var result;
|
||||
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.next = 2;
|
||||
return asyncAct( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
||||
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return cb();
|
||||
|
||||
case 2:
|
||||
result = _context.sent;
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee);
|
||||
})));
|
||||
|
||||
case 2:
|
||||
return _context2.abrupt("return", result);
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
|
||||
function asyncWrapper(_x) {
|
||||
return _asyncWrapper.apply(this, arguments);
|
||||
}
|
||||
|
||||
return asyncWrapper;
|
||||
}(),
|
||||
eventWrapper: function eventWrapper(cb) {
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
var mountedContainers = new Set();
|
||||
|
||||
function render(ui, _temp) {
|
||||
var _ref2 = _temp === void 0 ? {} : _temp,
|
||||
container = _ref2.container,
|
||||
_ref2$baseElement = _ref2.baseElement,
|
||||
baseElement = _ref2$baseElement === void 0 ? container : _ref2$baseElement,
|
||||
queries = _ref2.queries,
|
||||
_ref2$hydrate = _ref2.hydrate,
|
||||
hydrate = _ref2$hydrate === void 0 ? false : _ref2$hydrate,
|
||||
WrapperComponent = _ref2.wrapper;
|
||||
|
||||
if (!baseElement) {
|
||||
// default to document.body instead of documentElement to avoid output of potentially-large
|
||||
// head elements (such as JSS style blocks) in debug output
|
||||
baseElement = document.body;
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = baseElement.appendChild(document.createElement('div'));
|
||||
} // we'll add it to the mounted containers regardless of whether it's actually
|
||||
// added to document.body so the cleanup method works regardless of whether
|
||||
// they're passing us a custom container or not.
|
||||
|
||||
|
||||
mountedContainers.add(container);
|
||||
|
||||
var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) {
|
||||
return WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, innerElement) : innerElement;
|
||||
};
|
||||
|
||||
act(function () {
|
||||
if (hydrate) {
|
||||
ReactDOM.hydrate(wrapUiIfNeeded(ui), container);
|
||||
} else {
|
||||
ReactDOM.render(wrapUiIfNeeded(ui), container);
|
||||
}
|
||||
});
|
||||
return _extends({
|
||||
container: container,
|
||||
baseElement: baseElement,
|
||||
debug: function debug(el, maxLength, options) {
|
||||
if (el === void 0) {
|
||||
el = baseElement;
|
||||
}
|
||||
|
||||
return Array.isArray(el) ? // eslint-disable-next-line no-console
|
||||
el.forEach(function (e) {
|
||||
return console.log(prettyDOM(e, maxLength, options));
|
||||
}) : // eslint-disable-next-line no-console,
|
||||
console.log(prettyDOM(el, maxLength, options));
|
||||
},
|
||||
unmount: function unmount() {
|
||||
act(function () {
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
});
|
||||
},
|
||||
rerender: function rerender(rerenderUi) {
|
||||
render(wrapUiIfNeeded(rerenderUi), {
|
||||
container: container,
|
||||
baseElement: baseElement
|
||||
}); // Intentionally do not return anything to avoid unnecessarily complicating the API.
|
||||
// folks can use all the same utilities we return in the first place that are bound to the container
|
||||
},
|
||||
asFragment: function asFragment() {
|
||||
/* istanbul ignore else (old jsdom limitation) */
|
||||
if (typeof document.createRange === 'function') {
|
||||
return document.createRange().createContextualFragment(container.innerHTML);
|
||||
} else {
|
||||
var template = document.createElement('template');
|
||||
template.innerHTML = container.innerHTML;
|
||||
return template.content;
|
||||
}
|
||||
}
|
||||
}, getQueriesForElement(baseElement, queries));
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
mountedContainers.forEach(cleanupAtContainer);
|
||||
} // maybe one day we'll expose this (perhaps even as a utility returned by render).
|
||||
// but let's wait until someone asks for it.
|
||||
|
||||
|
||||
function cleanupAtContainer(container) {
|
||||
act(function () {
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
});
|
||||
|
||||
if (container.parentNode === document.body) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
|
||||
mountedContainers.delete(container);
|
||||
} // just re-export everything from dom-testing-library
|
||||
// thing for people using react-dom@16.8.0. Anyone else doesn't need it and
|
||||
// people should just upgrade anyway.
|
||||
|
||||
/* eslint func-name-matching:0 */
|
||||
|
||||
var _process$env;
|
||||
// or teardown then we'll automatically run cleanup afterEach test
|
||||
// this ensures that tests run in isolation from each other
|
||||
// if you don't like this then either import the `pure` module
|
||||
// or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'.
|
||||
|
||||
if (typeof process === "undefined" || !((_process$env = process.env) != null && _process$env.RTL_SKIP_AUTO_CLEANUP)) {
|
||||
// ignore teardown() in code coverage because Jest does not support it
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof afterEach === 'function') {
|
||||
afterEach(function () {
|
||||
cleanup();
|
||||
});
|
||||
} else if (typeof teardown === 'function') {
|
||||
// Block is guarded by `typeof` check.
|
||||
// eslint does not support `typeof` guards.
|
||||
// eslint-disable-next-line no-undef
|
||||
teardown(function () {
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { act, cleanup, fireEvent, render };
|
400
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js
generated
vendored
Normal file
400
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,400 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var _extends = require('@babel/runtime/helpers/extends');
|
||||
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
||||
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var dom = require('@testing-library/dom');
|
||||
var testUtils = require('react-dom/test-utils');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return e[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n['default'] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
||||
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
||||
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
||||
var testUtils__namespace = /*#__PURE__*/_interopNamespace(testUtils);
|
||||
|
||||
var reactAct = testUtils__namespace.act;
|
||||
var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0
|
||||
// so for versions that don't have act from test utils
|
||||
// we do this little polyfill. No warnings, but it's
|
||||
// better than nothing.
|
||||
|
||||
function actPolyfill(cb) {
|
||||
ReactDOM__default['default'].unstable_batchedUpdates(cb);
|
||||
ReactDOM__default['default'].render( /*#__PURE__*/React__namespace.createElement("div", null), document.createElement('div'));
|
||||
}
|
||||
|
||||
var act = reactAct || actPolyfill;
|
||||
var youHaveBeenWarned = false;
|
||||
var isAsyncActSupported = null;
|
||||
|
||||
function asyncAct(cb) {
|
||||
if (actSupported === true) {
|
||||
if (isAsyncActSupported === null) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// patch console.error here
|
||||
var originalConsoleError = console.error;
|
||||
|
||||
console.error = function error() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
/* if console.error fired *with that specific message* */
|
||||
|
||||
/* istanbul ignore next */
|
||||
var firstArgIsString = typeof args[0] === 'string';
|
||||
|
||||
if (firstArgIsString && args[0].indexOf('Warning: Do not await the result of calling ReactTestUtils.act') === 0) {
|
||||
// v16.8.6
|
||||
isAsyncActSupported = false;
|
||||
} else if (firstArgIsString && args[0].indexOf('Warning: The callback passed to ReactTestUtils.act(...) function must not return anything') === 0) ; else {
|
||||
originalConsoleError.apply(console, args);
|
||||
}
|
||||
};
|
||||
|
||||
var cbReturn, result;
|
||||
|
||||
try {
|
||||
result = reactAct(function () {
|
||||
cbReturn = cb();
|
||||
return cbReturn;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error = originalConsoleError;
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
result.then(function () {
|
||||
console.error = originalConsoleError; // if it got here, it means async act is supported
|
||||
|
||||
isAsyncActSupported = true;
|
||||
resolve();
|
||||
}, function (err) {
|
||||
console.error = originalConsoleError;
|
||||
isAsyncActSupported = true;
|
||||
reject(err);
|
||||
}); // 16.8.6's act().then() doesn't call a resolve handler, so we need to manually flush here, sigh
|
||||
|
||||
if (isAsyncActSupported === false) {
|
||||
console.error = originalConsoleError;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (!youHaveBeenWarned) {
|
||||
// if act is supported and async act isn't and they're trying to use async
|
||||
// act, then they need to upgrade from 16.8 to 16.9.
|
||||
// This is a seamless upgrade, so we'll add a warning
|
||||
console.error("It looks like you're using a version of react-dom that supports the \"act\" function, but not an awaitable version of \"act\" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.");
|
||||
youHaveBeenWarned = true;
|
||||
}
|
||||
|
||||
cbReturn.then(function () {
|
||||
// a faux-version.
|
||||
// todo - copy https://github.com/facebook/react/blob/master/packages/shared/enqueueTask.js
|
||||
Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
resolve();
|
||||
});
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
} else if (isAsyncActSupported === false) {
|
||||
// use the polyfill directly
|
||||
var _result;
|
||||
|
||||
act(function () {
|
||||
_result = cb();
|
||||
});
|
||||
return _result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
} // all good! regular act
|
||||
|
||||
|
||||
return act(cb);
|
||||
} // use the polyfill
|
||||
|
||||
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
}
|
||||
/* eslint no-console:0 */
|
||||
|
||||
// dom-testing-library's version of fireEvent. The reason
|
||||
// we make this distinction however is because we have
|
||||
// a few extra events that work a bit differently
|
||||
|
||||
var fireEvent = function fireEvent() {
|
||||
return dom.fireEvent.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
Object.keys(dom.fireEvent).forEach(function (key) {
|
||||
fireEvent[key] = function () {
|
||||
return dom.fireEvent[key].apply(dom.fireEvent, arguments);
|
||||
};
|
||||
}); // React event system tracks native mouseOver/mouseOut events for
|
||||
// running onMouseEnter/onMouseLeave handlers
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
|
||||
|
||||
var mouseEnter = fireEvent.mouseEnter;
|
||||
var mouseLeave = fireEvent.mouseLeave;
|
||||
|
||||
fireEvent.mouseEnter = function () {
|
||||
mouseEnter.apply(void 0, arguments);
|
||||
return fireEvent.mouseOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.mouseLeave = function () {
|
||||
mouseLeave.apply(void 0, arguments);
|
||||
return fireEvent.mouseOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var pointerEnter = fireEvent.pointerEnter;
|
||||
var pointerLeave = fireEvent.pointerLeave;
|
||||
|
||||
fireEvent.pointerEnter = function () {
|
||||
pointerEnter.apply(void 0, arguments);
|
||||
return fireEvent.pointerOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.pointerLeave = function () {
|
||||
pointerLeave.apply(void 0, arguments);
|
||||
return fireEvent.pointerOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var select = fireEvent.select;
|
||||
|
||||
fireEvent.select = function (node, init) {
|
||||
select(node, init); // React tracks this event only on focused inputs
|
||||
|
||||
node.focus(); // React creates this event when one of the following native events happens
|
||||
// - contextMenu
|
||||
// - mouseUp
|
||||
// - dragEnd
|
||||
// - keyUp
|
||||
// - keyDown
|
||||
// so we can use any here
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
|
||||
|
||||
fireEvent.keyUp(node, init);
|
||||
}; // React event system tracks native focusout/focusin events for
|
||||
// running blur/focus handlers
|
||||
// @link https://github.com/facebook/react/pull/19186
|
||||
|
||||
|
||||
var blur = fireEvent.blur;
|
||||
var focus = fireEvent.focus;
|
||||
|
||||
fireEvent.blur = function () {
|
||||
fireEvent.focusOut.apply(fireEvent, arguments);
|
||||
return blur.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
fireEvent.focus = function () {
|
||||
fireEvent.focusIn.apply(fireEvent, arguments);
|
||||
return focus.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
dom.configure({
|
||||
asyncWrapper: function () {
|
||||
var _asyncWrapper = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(cb) {
|
||||
var result;
|
||||
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.next = 2;
|
||||
return asyncAct( /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
||||
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return cb();
|
||||
|
||||
case 2:
|
||||
result = _context.sent;
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee);
|
||||
})));
|
||||
|
||||
case 2:
|
||||
return _context2.abrupt("return", result);
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
|
||||
function asyncWrapper(_x) {
|
||||
return _asyncWrapper.apply(this, arguments);
|
||||
}
|
||||
|
||||
return asyncWrapper;
|
||||
}(),
|
||||
eventWrapper: function eventWrapper(cb) {
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
var mountedContainers = new Set();
|
||||
|
||||
function render(ui, _temp) {
|
||||
var _ref2 = _temp === void 0 ? {} : _temp,
|
||||
container = _ref2.container,
|
||||
_ref2$baseElement = _ref2.baseElement,
|
||||
baseElement = _ref2$baseElement === void 0 ? container : _ref2$baseElement,
|
||||
queries = _ref2.queries,
|
||||
_ref2$hydrate = _ref2.hydrate,
|
||||
hydrate = _ref2$hydrate === void 0 ? false : _ref2$hydrate,
|
||||
WrapperComponent = _ref2.wrapper;
|
||||
|
||||
if (!baseElement) {
|
||||
// default to document.body instead of documentElement to avoid output of potentially-large
|
||||
// head elements (such as JSS style blocks) in debug output
|
||||
baseElement = document.body;
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = baseElement.appendChild(document.createElement('div'));
|
||||
} // we'll add it to the mounted containers regardless of whether it's actually
|
||||
// added to document.body so the cleanup method works regardless of whether
|
||||
// they're passing us a custom container or not.
|
||||
|
||||
|
||||
mountedContainers.add(container);
|
||||
|
||||
var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) {
|
||||
return WrapperComponent ? /*#__PURE__*/React__namespace.createElement(WrapperComponent, null, innerElement) : innerElement;
|
||||
};
|
||||
|
||||
act(function () {
|
||||
if (hydrate) {
|
||||
ReactDOM__default['default'].hydrate(wrapUiIfNeeded(ui), container);
|
||||
} else {
|
||||
ReactDOM__default['default'].render(wrapUiIfNeeded(ui), container);
|
||||
}
|
||||
});
|
||||
return _extends__default['default']({
|
||||
container: container,
|
||||
baseElement: baseElement,
|
||||
debug: function debug(el, maxLength, options) {
|
||||
if (el === void 0) {
|
||||
el = baseElement;
|
||||
}
|
||||
|
||||
return Array.isArray(el) ? // eslint-disable-next-line no-console
|
||||
el.forEach(function (e) {
|
||||
return console.log(dom.prettyDOM(e, maxLength, options));
|
||||
}) : // eslint-disable-next-line no-console,
|
||||
console.log(dom.prettyDOM(el, maxLength, options));
|
||||
},
|
||||
unmount: function unmount() {
|
||||
act(function () {
|
||||
ReactDOM__default['default'].unmountComponentAtNode(container);
|
||||
});
|
||||
},
|
||||
rerender: function rerender(rerenderUi) {
|
||||
render(wrapUiIfNeeded(rerenderUi), {
|
||||
container: container,
|
||||
baseElement: baseElement
|
||||
}); // Intentionally do not return anything to avoid unnecessarily complicating the API.
|
||||
// folks can use all the same utilities we return in the first place that are bound to the container
|
||||
},
|
||||
asFragment: function asFragment() {
|
||||
/* istanbul ignore else (old jsdom limitation) */
|
||||
if (typeof document.createRange === 'function') {
|
||||
return document.createRange().createContextualFragment(container.innerHTML);
|
||||
} else {
|
||||
var template = document.createElement('template');
|
||||
template.innerHTML = container.innerHTML;
|
||||
return template.content;
|
||||
}
|
||||
}
|
||||
}, dom.getQueriesForElement(baseElement, queries));
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
mountedContainers.forEach(cleanupAtContainer);
|
||||
} // maybe one day we'll expose this (perhaps even as a utility returned by render).
|
||||
// but let's wait until someone asks for it.
|
||||
|
||||
|
||||
function cleanupAtContainer(container) {
|
||||
act(function () {
|
||||
ReactDOM__default['default'].unmountComponentAtNode(container);
|
||||
});
|
||||
|
||||
if (container.parentNode === document.body) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
|
||||
mountedContainers.delete(container);
|
||||
} // just re-export everything from dom-testing-library
|
||||
// thing for people using react-dom@16.8.0. Anyone else doesn't need it and
|
||||
// people should just upgrade anyway.
|
||||
|
||||
/* eslint func-name-matching:0 */
|
||||
|
||||
exports.act = act;
|
||||
exports.cleanup = cleanup;
|
||||
exports.fireEvent = fireEvent;
|
||||
exports.render = render;
|
||||
Object.keys(dom).forEach(function (k) {
|
||||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return dom[k];
|
||||
}
|
||||
});
|
||||
});
|
357
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js
generated
vendored
Normal file
357
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js
generated
vendored
Normal file
|
@ -0,0 +1,357 @@
|
|||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
|
||||
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
||||
import * as React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { fireEvent as fireEvent$1, configure, prettyDOM, getQueriesForElement } from '@testing-library/dom';
|
||||
export * from '@testing-library/dom';
|
||||
import * as testUtils from 'react-dom/test-utils';
|
||||
|
||||
var reactAct = testUtils.act;
|
||||
var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0
|
||||
// so for versions that don't have act from test utils
|
||||
// we do this little polyfill. No warnings, but it's
|
||||
// better than nothing.
|
||||
|
||||
function actPolyfill(cb) {
|
||||
ReactDOM.unstable_batchedUpdates(cb);
|
||||
ReactDOM.render( /*#__PURE__*/React.createElement("div", null), document.createElement('div'));
|
||||
}
|
||||
|
||||
var act = reactAct || actPolyfill;
|
||||
var youHaveBeenWarned = false;
|
||||
var isAsyncActSupported = null;
|
||||
|
||||
function asyncAct(cb) {
|
||||
if (actSupported === true) {
|
||||
if (isAsyncActSupported === null) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// patch console.error here
|
||||
var originalConsoleError = console.error;
|
||||
|
||||
console.error = function error() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
/* if console.error fired *with that specific message* */
|
||||
|
||||
/* istanbul ignore next */
|
||||
var firstArgIsString = typeof args[0] === 'string';
|
||||
|
||||
if (firstArgIsString && args[0].indexOf('Warning: Do not await the result of calling ReactTestUtils.act') === 0) {
|
||||
// v16.8.6
|
||||
isAsyncActSupported = false;
|
||||
} else if (firstArgIsString && args[0].indexOf('Warning: The callback passed to ReactTestUtils.act(...) function must not return anything') === 0) ; else {
|
||||
originalConsoleError.apply(console, args);
|
||||
}
|
||||
};
|
||||
|
||||
var cbReturn, result;
|
||||
|
||||
try {
|
||||
result = reactAct(function () {
|
||||
cbReturn = cb();
|
||||
return cbReturn;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error = originalConsoleError;
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
result.then(function () {
|
||||
console.error = originalConsoleError; // if it got here, it means async act is supported
|
||||
|
||||
isAsyncActSupported = true;
|
||||
resolve();
|
||||
}, function (err) {
|
||||
console.error = originalConsoleError;
|
||||
isAsyncActSupported = true;
|
||||
reject(err);
|
||||
}); // 16.8.6's act().then() doesn't call a resolve handler, so we need to manually flush here, sigh
|
||||
|
||||
if (isAsyncActSupported === false) {
|
||||
console.error = originalConsoleError;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (!youHaveBeenWarned) {
|
||||
// if act is supported and async act isn't and they're trying to use async
|
||||
// act, then they need to upgrade from 16.8 to 16.9.
|
||||
// This is a seamless upgrade, so we'll add a warning
|
||||
console.error("It looks like you're using a version of react-dom that supports the \"act\" function, but not an awaitable version of \"act\" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.");
|
||||
youHaveBeenWarned = true;
|
||||
}
|
||||
|
||||
cbReturn.then(function () {
|
||||
// a faux-version.
|
||||
// todo - copy https://github.com/facebook/react/blob/master/packages/shared/enqueueTask.js
|
||||
Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
resolve();
|
||||
});
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
} else if (isAsyncActSupported === false) {
|
||||
// use the polyfill directly
|
||||
var _result;
|
||||
|
||||
act(function () {
|
||||
_result = cb();
|
||||
});
|
||||
return _result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
} // all good! regular act
|
||||
|
||||
|
||||
return act(cb);
|
||||
} // use the polyfill
|
||||
|
||||
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
// use sync act to flush effects
|
||||
act(function () {});
|
||||
});
|
||||
});
|
||||
}
|
||||
/* eslint no-console:0 */
|
||||
|
||||
// dom-testing-library's version of fireEvent. The reason
|
||||
// we make this distinction however is because we have
|
||||
// a few extra events that work a bit differently
|
||||
|
||||
var fireEvent = function fireEvent() {
|
||||
return fireEvent$1.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
Object.keys(fireEvent$1).forEach(function (key) {
|
||||
fireEvent[key] = function () {
|
||||
return fireEvent$1[key].apply(fireEvent$1, arguments);
|
||||
};
|
||||
}); // React event system tracks native mouseOver/mouseOut events for
|
||||
// running onMouseEnter/onMouseLeave handlers
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
|
||||
|
||||
var mouseEnter = fireEvent.mouseEnter;
|
||||
var mouseLeave = fireEvent.mouseLeave;
|
||||
|
||||
fireEvent.mouseEnter = function () {
|
||||
mouseEnter.apply(void 0, arguments);
|
||||
return fireEvent.mouseOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.mouseLeave = function () {
|
||||
mouseLeave.apply(void 0, arguments);
|
||||
return fireEvent.mouseOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var pointerEnter = fireEvent.pointerEnter;
|
||||
var pointerLeave = fireEvent.pointerLeave;
|
||||
|
||||
fireEvent.pointerEnter = function () {
|
||||
pointerEnter.apply(void 0, arguments);
|
||||
return fireEvent.pointerOver.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
fireEvent.pointerLeave = function () {
|
||||
pointerLeave.apply(void 0, arguments);
|
||||
return fireEvent.pointerOut.apply(fireEvent, arguments);
|
||||
};
|
||||
|
||||
var select = fireEvent.select;
|
||||
|
||||
fireEvent.select = function (node, init) {
|
||||
select(node, init); // React tracks this event only on focused inputs
|
||||
|
||||
node.focus(); // React creates this event when one of the following native events happens
|
||||
// - contextMenu
|
||||
// - mouseUp
|
||||
// - dragEnd
|
||||
// - keyUp
|
||||
// - keyDown
|
||||
// so we can use any here
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
|
||||
|
||||
fireEvent.keyUp(node, init);
|
||||
}; // React event system tracks native focusout/focusin events for
|
||||
// running blur/focus handlers
|
||||
// @link https://github.com/facebook/react/pull/19186
|
||||
|
||||
|
||||
var blur = fireEvent.blur;
|
||||
var focus = fireEvent.focus;
|
||||
|
||||
fireEvent.blur = function () {
|
||||
fireEvent.focusOut.apply(fireEvent, arguments);
|
||||
return blur.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
fireEvent.focus = function () {
|
||||
fireEvent.focusIn.apply(fireEvent, arguments);
|
||||
return focus.apply(void 0, arguments);
|
||||
};
|
||||
|
||||
configure({
|
||||
asyncWrapper: function () {
|
||||
var _asyncWrapper = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cb) {
|
||||
var result;
|
||||
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.next = 2;
|
||||
return asyncAct( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
||||
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return cb();
|
||||
|
||||
case 2:
|
||||
result = _context.sent;
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee);
|
||||
})));
|
||||
|
||||
case 2:
|
||||
return _context2.abrupt("return", result);
|
||||
|
||||
case 3:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
|
||||
function asyncWrapper(_x) {
|
||||
return _asyncWrapper.apply(this, arguments);
|
||||
}
|
||||
|
||||
return asyncWrapper;
|
||||
}(),
|
||||
eventWrapper: function eventWrapper(cb) {
|
||||
var result;
|
||||
act(function () {
|
||||
result = cb();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
var mountedContainers = new Set();
|
||||
|
||||
function render(ui, _temp) {
|
||||
var _ref2 = _temp === void 0 ? {} : _temp,
|
||||
container = _ref2.container,
|
||||
_ref2$baseElement = _ref2.baseElement,
|
||||
baseElement = _ref2$baseElement === void 0 ? container : _ref2$baseElement,
|
||||
queries = _ref2.queries,
|
||||
_ref2$hydrate = _ref2.hydrate,
|
||||
hydrate = _ref2$hydrate === void 0 ? false : _ref2$hydrate,
|
||||
WrapperComponent = _ref2.wrapper;
|
||||
|
||||
if (!baseElement) {
|
||||
// default to document.body instead of documentElement to avoid output of potentially-large
|
||||
// head elements (such as JSS style blocks) in debug output
|
||||
baseElement = document.body;
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = baseElement.appendChild(document.createElement('div'));
|
||||
} // we'll add it to the mounted containers regardless of whether it's actually
|
||||
// added to document.body so the cleanup method works regardless of whether
|
||||
// they're passing us a custom container or not.
|
||||
|
||||
|
||||
mountedContainers.add(container);
|
||||
|
||||
var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) {
|
||||
return WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, innerElement) : innerElement;
|
||||
};
|
||||
|
||||
act(function () {
|
||||
if (hydrate) {
|
||||
ReactDOM.hydrate(wrapUiIfNeeded(ui), container);
|
||||
} else {
|
||||
ReactDOM.render(wrapUiIfNeeded(ui), container);
|
||||
}
|
||||
});
|
||||
return _extends({
|
||||
container: container,
|
||||
baseElement: baseElement,
|
||||
debug: function debug(el, maxLength, options) {
|
||||
if (el === void 0) {
|
||||
el = baseElement;
|
||||
}
|
||||
|
||||
return Array.isArray(el) ? // eslint-disable-next-line no-console
|
||||
el.forEach(function (e) {
|
||||
return console.log(prettyDOM(e, maxLength, options));
|
||||
}) : // eslint-disable-next-line no-console,
|
||||
console.log(prettyDOM(el, maxLength, options));
|
||||
},
|
||||
unmount: function unmount() {
|
||||
act(function () {
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
});
|
||||
},
|
||||
rerender: function rerender(rerenderUi) {
|
||||
render(wrapUiIfNeeded(rerenderUi), {
|
||||
container: container,
|
||||
baseElement: baseElement
|
||||
}); // Intentionally do not return anything to avoid unnecessarily complicating the API.
|
||||
// folks can use all the same utilities we return in the first place that are bound to the container
|
||||
},
|
||||
asFragment: function asFragment() {
|
||||
/* istanbul ignore else (old jsdom limitation) */
|
||||
if (typeof document.createRange === 'function') {
|
||||
return document.createRange().createContextualFragment(container.innerHTML);
|
||||
} else {
|
||||
var template = document.createElement('template');
|
||||
template.innerHTML = container.innerHTML;
|
||||
return template.content;
|
||||
}
|
||||
}
|
||||
}, getQueriesForElement(baseElement, queries));
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
mountedContainers.forEach(cleanupAtContainer);
|
||||
} // maybe one day we'll expose this (perhaps even as a utility returned by render).
|
||||
// but let's wait until someone asks for it.
|
||||
|
||||
|
||||
function cleanupAtContainer(container) {
|
||||
act(function () {
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
});
|
||||
|
||||
if (container.parentNode === document.body) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
|
||||
mountedContainers.delete(container);
|
||||
} // just re-export everything from dom-testing-library
|
||||
// thing for people using react-dom@16.8.0. Anyone else doesn't need it and
|
||||
// people should just upgrade anyway.
|
||||
|
||||
/* eslint func-name-matching:0 */
|
||||
|
||||
export { act, cleanup, fireEvent, render };
|
18111
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js
generated
vendored
Normal file
18111
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map
generated
vendored
Normal file
1
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js
generated
vendored
Normal file
11
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map
generated
vendored
Normal file
1
web/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18135
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.js
generated
vendored
Normal file
18135
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map
generated
vendored
Normal file
1
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js
generated
vendored
Normal file
11
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map
generated
vendored
Normal file
1
web/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
140
web/node_modules/@testing-library/react/dist/act-compat.js
generated
vendored
Normal file
140
web/node_modules/@testing-library/react/dist/act-compat.js
generated
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.asyncAct = asyncAct;
|
||||
exports.default = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
|
||||
var testUtils = _interopRequireWildcard(require("react-dom/test-utils"));
|
||||
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const reactAct = testUtils.act;
|
||||
const actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0
|
||||
// so for versions that don't have act from test utils
|
||||
// we do this little polyfill. No warnings, but it's
|
||||
// better than nothing.
|
||||
|
||||
function actPolyfill(cb) {
|
||||
_reactDom.default.unstable_batchedUpdates(cb);
|
||||
|
||||
_reactDom.default.render( /*#__PURE__*/React.createElement("div", null), document.createElement('div'));
|
||||
}
|
||||
|
||||
const act = reactAct || actPolyfill;
|
||||
let youHaveBeenWarned = false;
|
||||
let isAsyncActSupported = null;
|
||||
|
||||
function asyncAct(cb) {
|
||||
if (actSupported === true) {
|
||||
if (isAsyncActSupported === null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// patch console.error here
|
||||
const originalConsoleError = console.error;
|
||||
|
||||
console.error = function error(...args) {
|
||||
/* if console.error fired *with that specific message* */
|
||||
|
||||
/* istanbul ignore next */
|
||||
const firstArgIsString = typeof args[0] === 'string';
|
||||
|
||||
if (firstArgIsString && args[0].indexOf('Warning: Do not await the result of calling ReactTestUtils.act') === 0) {
|
||||
// v16.8.6
|
||||
isAsyncActSupported = false;
|
||||
} else if (firstArgIsString && args[0].indexOf('Warning: The callback passed to ReactTestUtils.act(...) function must not return anything') === 0) {// no-op
|
||||
} else {
|
||||
originalConsoleError.apply(console, args);
|
||||
}
|
||||
};
|
||||
|
||||
let cbReturn, result;
|
||||
|
||||
try {
|
||||
result = reactAct(() => {
|
||||
cbReturn = cb();
|
||||
return cbReturn;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error = originalConsoleError;
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
result.then(() => {
|
||||
console.error = originalConsoleError; // if it got here, it means async act is supported
|
||||
|
||||
isAsyncActSupported = true;
|
||||
resolve();
|
||||
}, err => {
|
||||
console.error = originalConsoleError;
|
||||
isAsyncActSupported = true;
|
||||
reject(err);
|
||||
}); // 16.8.6's act().then() doesn't call a resolve handler, so we need to manually flush here, sigh
|
||||
|
||||
if (isAsyncActSupported === false) {
|
||||
console.error = originalConsoleError;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (!youHaveBeenWarned) {
|
||||
// if act is supported and async act isn't and they're trying to use async
|
||||
// act, then they need to upgrade from 16.8 to 16.9.
|
||||
// This is a seamless upgrade, so we'll add a warning
|
||||
console.error(`It looks like you're using a version of react-dom that supports the "act" function, but not an awaitable version of "act" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.`);
|
||||
youHaveBeenWarned = true;
|
||||
}
|
||||
|
||||
cbReturn.then(() => {
|
||||
// a faux-version.
|
||||
// todo - copy https://github.com/facebook/react/blob/master/packages/shared/enqueueTask.js
|
||||
Promise.resolve().then(() => {
|
||||
// use sync act to flush effects
|
||||
act(() => {});
|
||||
resolve();
|
||||
});
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
} else if (isAsyncActSupported === false) {
|
||||
// use the polyfill directly
|
||||
let result;
|
||||
act(() => {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(() => {
|
||||
return Promise.resolve().then(() => {
|
||||
// use sync act to flush effects
|
||||
act(() => {});
|
||||
});
|
||||
});
|
||||
} // all good! regular act
|
||||
|
||||
|
||||
return act(cb);
|
||||
} // use the polyfill
|
||||
|
||||
|
||||
let result;
|
||||
act(() => {
|
||||
result = cb();
|
||||
});
|
||||
return result.then(() => {
|
||||
return Promise.resolve().then(() => {
|
||||
// use sync act to flush effects
|
||||
act(() => {});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var _default = act;
|
||||
/* eslint no-console:0 */
|
||||
|
||||
exports.default = _default;
|
80
web/node_modules/@testing-library/react/dist/fire-event.js
generated
vendored
Normal file
80
web/node_modules/@testing-library/react/dist/fire-event.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.fireEvent = void 0;
|
||||
|
||||
var _dom = require("@testing-library/dom");
|
||||
|
||||
// react-testing-library's version of fireEvent will call
|
||||
// dom-testing-library's version of fireEvent. The reason
|
||||
// we make this distinction however is because we have
|
||||
// a few extra events that work a bit differently
|
||||
const fireEvent = (...args) => (0, _dom.fireEvent)(...args);
|
||||
|
||||
exports.fireEvent = fireEvent;
|
||||
Object.keys(_dom.fireEvent).forEach(key => {
|
||||
fireEvent[key] = (...args) => _dom.fireEvent[key](...args);
|
||||
}); // React event system tracks native mouseOver/mouseOut events for
|
||||
// running onMouseEnter/onMouseLeave handlers
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
|
||||
|
||||
const mouseEnter = fireEvent.mouseEnter;
|
||||
const mouseLeave = fireEvent.mouseLeave;
|
||||
|
||||
fireEvent.mouseEnter = (...args) => {
|
||||
mouseEnter(...args);
|
||||
return fireEvent.mouseOver(...args);
|
||||
};
|
||||
|
||||
fireEvent.mouseLeave = (...args) => {
|
||||
mouseLeave(...args);
|
||||
return fireEvent.mouseOut(...args);
|
||||
};
|
||||
|
||||
const pointerEnter = fireEvent.pointerEnter;
|
||||
const pointerLeave = fireEvent.pointerLeave;
|
||||
|
||||
fireEvent.pointerEnter = (...args) => {
|
||||
pointerEnter(...args);
|
||||
return fireEvent.pointerOver(...args);
|
||||
};
|
||||
|
||||
fireEvent.pointerLeave = (...args) => {
|
||||
pointerLeave(...args);
|
||||
return fireEvent.pointerOut(...args);
|
||||
};
|
||||
|
||||
const select = fireEvent.select;
|
||||
|
||||
fireEvent.select = (node, init) => {
|
||||
select(node, init); // React tracks this event only on focused inputs
|
||||
|
||||
node.focus(); // React creates this event when one of the following native events happens
|
||||
// - contextMenu
|
||||
// - mouseUp
|
||||
// - dragEnd
|
||||
// - keyUp
|
||||
// - keyDown
|
||||
// so we can use any here
|
||||
// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
|
||||
|
||||
fireEvent.keyUp(node, init);
|
||||
}; // React event system tracks native focusout/focusin events for
|
||||
// running blur/focus handlers
|
||||
// @link https://github.com/facebook/react/pull/19186
|
||||
|
||||
|
||||
const blur = fireEvent.blur;
|
||||
const focus = fireEvent.focus;
|
||||
|
||||
fireEvent.blur = (...args) => {
|
||||
fireEvent.focusOut(...args);
|
||||
return blur(...args);
|
||||
};
|
||||
|
||||
fireEvent.focus = (...args) => {
|
||||
fireEvent.focusIn(...args);
|
||||
return focus(...args);
|
||||
};
|
43
web/node_modules/@testing-library/react/dist/index.js
generated
vendored
Normal file
43
web/node_modules/@testing-library/react/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _pure = require("./pure");
|
||||
|
||||
Object.keys(_pure).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _pure[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _pure[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _process$env;
|
||||
|
||||
// if we're running in a test runner that supports afterEach
|
||||
// or teardown then we'll automatically run cleanup afterEach test
|
||||
// this ensures that tests run in isolation from each other
|
||||
// if you don't like this then either import the `pure` module
|
||||
// or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'.
|
||||
if (typeof process === "undefined" || !((_process$env = process.env) != null && _process$env.RTL_SKIP_AUTO_CLEANUP)) {
|
||||
// ignore teardown() in code coverage because Jest does not support it
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof afterEach === 'function') {
|
||||
afterEach(() => {
|
||||
(0, _pure.cleanup)();
|
||||
});
|
||||
} else if (typeof teardown === 'function') {
|
||||
// Block is guarded by `typeof` check.
|
||||
// eslint does not support `typeof` guards.
|
||||
// eslint-disable-next-line no-undef
|
||||
teardown(() => {
|
||||
(0, _pure.cleanup)();
|
||||
});
|
||||
}
|
||||
}
|
157
web/node_modules/@testing-library/react/dist/pure.js
generated
vendored
Normal file
157
web/node_modules/@testing-library/react/dist/pure.js
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
render: true,
|
||||
cleanup: true,
|
||||
act: true,
|
||||
fireEvent: true
|
||||
};
|
||||
exports.render = render;
|
||||
exports.cleanup = cleanup;
|
||||
Object.defineProperty(exports, "act", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _actCompat.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "fireEvent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _fireEvent.fireEvent;
|
||||
}
|
||||
});
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
|
||||
var _dom = require("@testing-library/dom");
|
||||
|
||||
Object.keys(_dom).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _dom[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _dom[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _actCompat = _interopRequireWildcard(require("./act-compat"));
|
||||
|
||||
var _fireEvent = require("./fire-event");
|
||||
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _dom.configure)({
|
||||
asyncWrapper: async cb => {
|
||||
let result;
|
||||
await (0, _actCompat.asyncAct)(async () => {
|
||||
result = await cb();
|
||||
});
|
||||
return result;
|
||||
},
|
||||
eventWrapper: cb => {
|
||||
let result;
|
||||
(0, _actCompat.default)(() => {
|
||||
result = cb();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
const mountedContainers = new Set();
|
||||
|
||||
function render(ui, {
|
||||
container,
|
||||
baseElement = container,
|
||||
queries,
|
||||
hydrate = false,
|
||||
wrapper: WrapperComponent
|
||||
} = {}) {
|
||||
if (!baseElement) {
|
||||
// default to document.body instead of documentElement to avoid output of potentially-large
|
||||
// head elements (such as JSS style blocks) in debug output
|
||||
baseElement = document.body;
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = baseElement.appendChild(document.createElement('div'));
|
||||
} // we'll add it to the mounted containers regardless of whether it's actually
|
||||
// added to document.body so the cleanup method works regardless of whether
|
||||
// they're passing us a custom container or not.
|
||||
|
||||
|
||||
mountedContainers.add(container);
|
||||
|
||||
const wrapUiIfNeeded = innerElement => WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, innerElement) : innerElement;
|
||||
|
||||
(0, _actCompat.default)(() => {
|
||||
if (hydrate) {
|
||||
_reactDom.default.hydrate(wrapUiIfNeeded(ui), container);
|
||||
} else {
|
||||
_reactDom.default.render(wrapUiIfNeeded(ui), container);
|
||||
}
|
||||
});
|
||||
return {
|
||||
container,
|
||||
baseElement,
|
||||
debug: (el = baseElement, maxLength, options) => Array.isArray(el) ? // eslint-disable-next-line no-console
|
||||
el.forEach(e => console.log((0, _dom.prettyDOM)(e, maxLength, options))) : // eslint-disable-next-line no-console,
|
||||
console.log((0, _dom.prettyDOM)(el, maxLength, options)),
|
||||
unmount: () => {
|
||||
(0, _actCompat.default)(() => {
|
||||
_reactDom.default.unmountComponentAtNode(container);
|
||||
});
|
||||
},
|
||||
rerender: rerenderUi => {
|
||||
render(wrapUiIfNeeded(rerenderUi), {
|
||||
container,
|
||||
baseElement
|
||||
}); // Intentionally do not return anything to avoid unnecessarily complicating the API.
|
||||
// folks can use all the same utilities we return in the first place that are bound to the container
|
||||
},
|
||||
asFragment: () => {
|
||||
/* istanbul ignore else (old jsdom limitation) */
|
||||
if (typeof document.createRange === 'function') {
|
||||
return document.createRange().createContextualFragment(container.innerHTML);
|
||||
} else {
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = container.innerHTML;
|
||||
return template.content;
|
||||
}
|
||||
},
|
||||
...(0, _dom.getQueriesForElement)(baseElement, queries)
|
||||
};
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
mountedContainers.forEach(cleanupAtContainer);
|
||||
} // maybe one day we'll expose this (perhaps even as a utility returned by render).
|
||||
// but let's wait until someone asks for it.
|
||||
|
||||
|
||||
function cleanupAtContainer(container) {
|
||||
(0, _actCompat.default)(() => {
|
||||
_reactDom.default.unmountComponentAtNode(container);
|
||||
});
|
||||
|
||||
if (container.parentNode === document.body) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
|
||||
mountedContainers.delete(container);
|
||||
} // just re-export everything from dom-testing-library
|
||||
// NOTE: we're not going to export asyncAct because that's our own compatibility
|
||||
// thing for people using react-dom@16.8.0. Anyone else doesn't need it and
|
||||
// people should just upgrade anyway.
|
||||
|
||||
/* eslint func-name-matching:0 */
|
Loading…
Add table
Add a link
Reference in a new issue