@testing-library/react
Advanced tools
Comparing version 13.0.0-alpha.3 to 13.0.0-alpha.4
@@ -424,3 +424,7 @@ 'use strict'; | ||
function createConcurrentRoot(container, options) { | ||
function createConcurrentRoot(container, _ref2) { | ||
var _hydrate = _ref2.hydrate, | ||
ui = _ref2.ui, | ||
WrapperComponent = _ref2.wrapper; | ||
if (typeof ReactDOM__default["default"].createRoot !== 'function') { | ||
@@ -430,11 +434,19 @@ throw new TypeError("Attempted to use concurrent React with `react-dom@" + ReactDOM__default["default"].version + "`. Be sure to use the `next` or `experimental` release channel (https://reactjs.org/docs/release-channels.html).'"); | ||
var root = options.hydrate ? ReactDOM__default["default"].hydrateRoot(container) : ReactDOM__default["default"].createRoot(container); | ||
var root; | ||
if (_hydrate) { | ||
act(function () { | ||
root = ReactDOM__default["default"].hydrateRoot(container, WrapperComponent ? /*#__PURE__*/React__namespace.createElement(WrapperComponent, null, ui) : ui); | ||
}); | ||
} else { | ||
root = ReactDOM__default["default"].createRoot(container); | ||
} | ||
return { | ||
hydrate: function hydrate(element) { | ||
hydrate: function hydrate() { | ||
/* istanbul ignore if */ | ||
if (!options.hydrate) { | ||
if (!_hydrate) { | ||
throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.'); | ||
} | ||
} // Nothing to do since hydration happens when creating the root object. | ||
root.render(element); | ||
}, | ||
@@ -464,9 +476,9 @@ render: function render(element) { | ||
function renderRoot(ui, _ref2) { | ||
var baseElement = _ref2.baseElement, | ||
container = _ref2.container, | ||
hydrate = _ref2.hydrate, | ||
queries = _ref2.queries, | ||
root = _ref2.root, | ||
WrapperComponent = _ref2.wrapper; | ||
function renderRoot(ui, _ref3) { | ||
var baseElement = _ref3.baseElement, | ||
container = _ref3.container, | ||
hydrate = _ref3.hydrate, | ||
queries = _ref3.queries, | ||
root = _ref3.root, | ||
WrapperComponent = _ref3.wrapper; | ||
@@ -525,12 +537,12 @@ var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) { | ||
function render(ui, _temp) { | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
container = _ref3.container, | ||
_ref3$baseElement = _ref3.baseElement, | ||
baseElement = _ref3$baseElement === void 0 ? container : _ref3$baseElement, | ||
_ref3$legacyRoot = _ref3.legacyRoot, | ||
legacyRoot = _ref3$legacyRoot === void 0 ? typeof ReactDOM__default["default"].createRoot !== 'function' : _ref3$legacyRoot, | ||
queries = _ref3.queries, | ||
_ref3$hydrate = _ref3.hydrate, | ||
hydrate = _ref3$hydrate === void 0 ? false : _ref3$hydrate, | ||
wrapper = _ref3.wrapper; | ||
var _ref4 = _temp === void 0 ? {} : _temp, | ||
container = _ref4.container, | ||
_ref4$baseElement = _ref4.baseElement, | ||
baseElement = _ref4$baseElement === void 0 ? container : _ref4$baseElement, | ||
_ref4$legacyRoot = _ref4.legacyRoot, | ||
legacyRoot = _ref4$legacyRoot === void 0 ? typeof ReactDOM__default["default"].createRoot !== 'function' : _ref4$legacyRoot, | ||
queries = _ref4.queries, | ||
_ref4$hydrate = _ref4.hydrate, | ||
hydrate = _ref4$hydrate === void 0 ? false : _ref4$hydrate, | ||
wrapper = _ref4.wrapper; | ||
@@ -552,3 +564,5 @@ if (!baseElement) { | ||
root = createRootImpl(container, { | ||
hydrate: hydrate | ||
hydrate: hydrate, | ||
ui: ui, | ||
wrapper: wrapper | ||
}); | ||
@@ -582,5 +596,5 @@ mountedRootEntries.push({ | ||
function cleanup() { | ||
mountedRootEntries.forEach(function (_ref4) { | ||
var root = _ref4.root, | ||
container = _ref4.container; | ||
mountedRootEntries.forEach(function (_ref5) { | ||
var root = _ref5.root, | ||
container = _ref5.container; | ||
act(function () { | ||
@@ -587,0 +601,0 @@ root.unmount(); |
@@ -394,3 +394,7 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
function createConcurrentRoot(container, options) { | ||
function createConcurrentRoot(container, _ref2) { | ||
var _hydrate = _ref2.hydrate, | ||
ui = _ref2.ui, | ||
WrapperComponent = _ref2.wrapper; | ||
if (typeof ReactDOM.createRoot !== 'function') { | ||
@@ -400,11 +404,19 @@ throw new TypeError("Attempted to use concurrent React with `react-dom@" + ReactDOM.version + "`. Be sure to use the `next` or `experimental` release channel (https://reactjs.org/docs/release-channels.html).'"); | ||
var root = options.hydrate ? ReactDOM.hydrateRoot(container) : ReactDOM.createRoot(container); | ||
var root; | ||
if (_hydrate) { | ||
act(function () { | ||
root = ReactDOM.hydrateRoot(container, WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, ui) : ui); | ||
}); | ||
} else { | ||
root = ReactDOM.createRoot(container); | ||
} | ||
return { | ||
hydrate: function hydrate(element) { | ||
hydrate: function hydrate() { | ||
/* istanbul ignore if */ | ||
if (!options.hydrate) { | ||
if (!_hydrate) { | ||
throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.'); | ||
} | ||
} // Nothing to do since hydration happens when creating the root object. | ||
root.render(element); | ||
}, | ||
@@ -434,9 +446,9 @@ render: function render(element) { | ||
function renderRoot(ui, _ref2) { | ||
var baseElement = _ref2.baseElement, | ||
container = _ref2.container, | ||
hydrate = _ref2.hydrate, | ||
queries = _ref2.queries, | ||
root = _ref2.root, | ||
WrapperComponent = _ref2.wrapper; | ||
function renderRoot(ui, _ref3) { | ||
var baseElement = _ref3.baseElement, | ||
container = _ref3.container, | ||
hydrate = _ref3.hydrate, | ||
queries = _ref3.queries, | ||
root = _ref3.root, | ||
WrapperComponent = _ref3.wrapper; | ||
@@ -495,12 +507,12 @@ var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) { | ||
function render(ui, _temp) { | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
container = _ref3.container, | ||
_ref3$baseElement = _ref3.baseElement, | ||
baseElement = _ref3$baseElement === void 0 ? container : _ref3$baseElement, | ||
_ref3$legacyRoot = _ref3.legacyRoot, | ||
legacyRoot = _ref3$legacyRoot === void 0 ? typeof ReactDOM.createRoot !== 'function' : _ref3$legacyRoot, | ||
queries = _ref3.queries, | ||
_ref3$hydrate = _ref3.hydrate, | ||
hydrate = _ref3$hydrate === void 0 ? false : _ref3$hydrate, | ||
wrapper = _ref3.wrapper; | ||
var _ref4 = _temp === void 0 ? {} : _temp, | ||
container = _ref4.container, | ||
_ref4$baseElement = _ref4.baseElement, | ||
baseElement = _ref4$baseElement === void 0 ? container : _ref4$baseElement, | ||
_ref4$legacyRoot = _ref4.legacyRoot, | ||
legacyRoot = _ref4$legacyRoot === void 0 ? typeof ReactDOM.createRoot !== 'function' : _ref4$legacyRoot, | ||
queries = _ref4.queries, | ||
_ref4$hydrate = _ref4.hydrate, | ||
hydrate = _ref4$hydrate === void 0 ? false : _ref4$hydrate, | ||
wrapper = _ref4.wrapper; | ||
@@ -522,3 +534,5 @@ if (!baseElement) { | ||
root = createRootImpl(container, { | ||
hydrate: hydrate | ||
hydrate: hydrate, | ||
ui: ui, | ||
wrapper: wrapper | ||
}); | ||
@@ -552,5 +566,5 @@ mountedRootEntries.push({ | ||
function cleanup() { | ||
mountedRootEntries.forEach(function (_ref4) { | ||
var root = _ref4.root, | ||
container = _ref4.container; | ||
mountedRootEntries.forEach(function (_ref5) { | ||
var root = _ref5.root, | ||
container = _ref5.container; | ||
act(function () { | ||
@@ -557,0 +571,0 @@ root.unmount(); |
@@ -424,3 +424,7 @@ 'use strict'; | ||
function createConcurrentRoot(container, options) { | ||
function createConcurrentRoot(container, _ref2) { | ||
var _hydrate = _ref2.hydrate, | ||
ui = _ref2.ui, | ||
WrapperComponent = _ref2.wrapper; | ||
if (typeof ReactDOM__default["default"].createRoot !== 'function') { | ||
@@ -430,11 +434,19 @@ throw new TypeError("Attempted to use concurrent React with `react-dom@" + ReactDOM__default["default"].version + "`. Be sure to use the `next` or `experimental` release channel (https://reactjs.org/docs/release-channels.html).'"); | ||
var root = options.hydrate ? ReactDOM__default["default"].hydrateRoot(container) : ReactDOM__default["default"].createRoot(container); | ||
var root; | ||
if (_hydrate) { | ||
act(function () { | ||
root = ReactDOM__default["default"].hydrateRoot(container, WrapperComponent ? /*#__PURE__*/React__namespace.createElement(WrapperComponent, null, ui) : ui); | ||
}); | ||
} else { | ||
root = ReactDOM__default["default"].createRoot(container); | ||
} | ||
return { | ||
hydrate: function hydrate(element) { | ||
hydrate: function hydrate() { | ||
/* istanbul ignore if */ | ||
if (!options.hydrate) { | ||
if (!_hydrate) { | ||
throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.'); | ||
} | ||
} // Nothing to do since hydration happens when creating the root object. | ||
root.render(element); | ||
}, | ||
@@ -464,9 +476,9 @@ render: function render(element) { | ||
function renderRoot(ui, _ref2) { | ||
var baseElement = _ref2.baseElement, | ||
container = _ref2.container, | ||
hydrate = _ref2.hydrate, | ||
queries = _ref2.queries, | ||
root = _ref2.root, | ||
WrapperComponent = _ref2.wrapper; | ||
function renderRoot(ui, _ref3) { | ||
var baseElement = _ref3.baseElement, | ||
container = _ref3.container, | ||
hydrate = _ref3.hydrate, | ||
queries = _ref3.queries, | ||
root = _ref3.root, | ||
WrapperComponent = _ref3.wrapper; | ||
@@ -525,12 +537,12 @@ var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) { | ||
function render(ui, _temp) { | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
container = _ref3.container, | ||
_ref3$baseElement = _ref3.baseElement, | ||
baseElement = _ref3$baseElement === void 0 ? container : _ref3$baseElement, | ||
_ref3$legacyRoot = _ref3.legacyRoot, | ||
legacyRoot = _ref3$legacyRoot === void 0 ? typeof ReactDOM__default["default"].createRoot !== 'function' : _ref3$legacyRoot, | ||
queries = _ref3.queries, | ||
_ref3$hydrate = _ref3.hydrate, | ||
hydrate = _ref3$hydrate === void 0 ? false : _ref3$hydrate, | ||
wrapper = _ref3.wrapper; | ||
var _ref4 = _temp === void 0 ? {} : _temp, | ||
container = _ref4.container, | ||
_ref4$baseElement = _ref4.baseElement, | ||
baseElement = _ref4$baseElement === void 0 ? container : _ref4$baseElement, | ||
_ref4$legacyRoot = _ref4.legacyRoot, | ||
legacyRoot = _ref4$legacyRoot === void 0 ? typeof ReactDOM__default["default"].createRoot !== 'function' : _ref4$legacyRoot, | ||
queries = _ref4.queries, | ||
_ref4$hydrate = _ref4.hydrate, | ||
hydrate = _ref4$hydrate === void 0 ? false : _ref4$hydrate, | ||
wrapper = _ref4.wrapper; | ||
@@ -552,3 +564,5 @@ if (!baseElement) { | ||
root = createRootImpl(container, { | ||
hydrate: hydrate | ||
hydrate: hydrate, | ||
ui: ui, | ||
wrapper: wrapper | ||
}); | ||
@@ -582,5 +596,5 @@ mountedRootEntries.push({ | ||
function cleanup() { | ||
mountedRootEntries.forEach(function (_ref4) { | ||
var root = _ref4.root, | ||
container = _ref4.container; | ||
mountedRootEntries.forEach(function (_ref5) { | ||
var root = _ref5.root, | ||
container = _ref5.container; | ||
act(function () { | ||
@@ -587,0 +601,0 @@ root.unmount(); |
@@ -394,3 +394,7 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
function createConcurrentRoot(container, options) { | ||
function createConcurrentRoot(container, _ref2) { | ||
var _hydrate = _ref2.hydrate, | ||
ui = _ref2.ui, | ||
WrapperComponent = _ref2.wrapper; | ||
if (typeof ReactDOM.createRoot !== 'function') { | ||
@@ -400,11 +404,19 @@ throw new TypeError("Attempted to use concurrent React with `react-dom@" + ReactDOM.version + "`. Be sure to use the `next` or `experimental` release channel (https://reactjs.org/docs/release-channels.html).'"); | ||
var root = options.hydrate ? ReactDOM.hydrateRoot(container) : ReactDOM.createRoot(container); | ||
var root; | ||
if (_hydrate) { | ||
act(function () { | ||
root = ReactDOM.hydrateRoot(container, WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, ui) : ui); | ||
}); | ||
} else { | ||
root = ReactDOM.createRoot(container); | ||
} | ||
return { | ||
hydrate: function hydrate(element) { | ||
hydrate: function hydrate() { | ||
/* istanbul ignore if */ | ||
if (!options.hydrate) { | ||
if (!_hydrate) { | ||
throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.'); | ||
} | ||
} // Nothing to do since hydration happens when creating the root object. | ||
root.render(element); | ||
}, | ||
@@ -434,9 +446,9 @@ render: function render(element) { | ||
function renderRoot(ui, _ref2) { | ||
var baseElement = _ref2.baseElement, | ||
container = _ref2.container, | ||
hydrate = _ref2.hydrate, | ||
queries = _ref2.queries, | ||
root = _ref2.root, | ||
WrapperComponent = _ref2.wrapper; | ||
function renderRoot(ui, _ref3) { | ||
var baseElement = _ref3.baseElement, | ||
container = _ref3.container, | ||
hydrate = _ref3.hydrate, | ||
queries = _ref3.queries, | ||
root = _ref3.root, | ||
WrapperComponent = _ref3.wrapper; | ||
@@ -495,12 +507,12 @@ var wrapUiIfNeeded = function wrapUiIfNeeded(innerElement) { | ||
function render(ui, _temp) { | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
container = _ref3.container, | ||
_ref3$baseElement = _ref3.baseElement, | ||
baseElement = _ref3$baseElement === void 0 ? container : _ref3$baseElement, | ||
_ref3$legacyRoot = _ref3.legacyRoot, | ||
legacyRoot = _ref3$legacyRoot === void 0 ? typeof ReactDOM.createRoot !== 'function' : _ref3$legacyRoot, | ||
queries = _ref3.queries, | ||
_ref3$hydrate = _ref3.hydrate, | ||
hydrate = _ref3$hydrate === void 0 ? false : _ref3$hydrate, | ||
wrapper = _ref3.wrapper; | ||
var _ref4 = _temp === void 0 ? {} : _temp, | ||
container = _ref4.container, | ||
_ref4$baseElement = _ref4.baseElement, | ||
baseElement = _ref4$baseElement === void 0 ? container : _ref4$baseElement, | ||
_ref4$legacyRoot = _ref4.legacyRoot, | ||
legacyRoot = _ref4$legacyRoot === void 0 ? typeof ReactDOM.createRoot !== 'function' : _ref4$legacyRoot, | ||
queries = _ref4.queries, | ||
_ref4$hydrate = _ref4.hydrate, | ||
hydrate = _ref4$hydrate === void 0 ? false : _ref4$hydrate, | ||
wrapper = _ref4.wrapper; | ||
@@ -522,3 +534,5 @@ if (!baseElement) { | ||
root = createRootImpl(container, { | ||
hydrate: hydrate | ||
hydrate: hydrate, | ||
ui: ui, | ||
wrapper: wrapper | ||
}); | ||
@@ -552,5 +566,5 @@ mountedRootEntries.push({ | ||
function cleanup() { | ||
mountedRootEntries.forEach(function (_ref4) { | ||
var root = _ref4.root, | ||
container = _ref4.container; | ||
mountedRootEntries.forEach(function (_ref5) { | ||
var root = _ref5.root, | ||
container = _ref5.container; | ||
act(function () { | ||
@@ -557,0 +571,0 @@ root.unmount(); |
@@ -106,3 +106,7 @@ "use strict"; | ||
function createConcurrentRoot(container, options) { | ||
function createConcurrentRoot(container, { | ||
hydrate, | ||
ui, | ||
wrapper: WrapperComponent | ||
}) { | ||
if (typeof _reactDom.default.createRoot !== 'function') { | ||
@@ -112,11 +116,19 @@ throw new TypeError(`Attempted to use concurrent React with \`react-dom@${_reactDom.default.version}\`. Be sure to use the \`next\` or \`experimental\` release channel (https://reactjs.org/docs/release-channels.html).'`); | ||
const root = options.hydrate ? _reactDom.default.hydrateRoot(container) : _reactDom.default.createRoot(container); | ||
let root; | ||
if (hydrate) { | ||
(0, _actCompat.default)(() => { | ||
root = _reactDom.default.hydrateRoot(container, WrapperComponent ? /*#__PURE__*/React.createElement(WrapperComponent, null, ui) : ui); | ||
}); | ||
} else { | ||
root = _reactDom.default.createRoot(container); | ||
} | ||
return { | ||
hydrate(element) { | ||
hydrate() { | ||
/* istanbul ignore if */ | ||
if (!options.hydrate) { | ||
if (!hydrate) { | ||
throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.'); | ||
} | ||
} // Nothing to do since hydration happens when creating the root object. | ||
root.render(element); | ||
}, | ||
@@ -225,3 +237,5 @@ | ||
root = createRootImpl(container, { | ||
hydrate | ||
hydrate, | ||
ui, | ||
wrapper | ||
}); | ||
@@ -228,0 +242,0 @@ mountedRootEntries.push({ |
{ | ||
"name": "@testing-library/react", | ||
"version": "13.0.0-alpha.3", | ||
"version": "13.0.0-alpha.4", | ||
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4357187
29163