Skip to content

Commit

Permalink
[enzyme-adapter-react-*] pass the adapter into createMountWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense authored and ljharb committed Mar 23, 2018
1 parent 8eabf3b commit b396e5c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/enzyme-adapter-react-13/src/ReactThirteenAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class ReactThirteenAdapter extends EnzymeAdapter {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -128,7 +129,7 @@ class ReactThirteenAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = React.render(wrappedEl, domNode);
if (typeof callback === 'function') {
Expand Down
3 changes: 2 additions & 1 deletion packages/enzyme-adapter-react-14/src/ReactFourteenAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ReactFourteenAdapter extends EnzymeAdapter {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -101,7 +102,7 @@ class ReactFourteenAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = ReactDOM.render(wrappedEl, domNode);
if (typeof callback === 'function') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ReactFifteenFourAdapter extends EnzymeAdapter {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -134,7 +135,7 @@ class ReactFifteenFourAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = ReactDOM.render(wrappedEl, domNode);
if (typeof callback === 'function') {
Expand Down
3 changes: 2 additions & 1 deletion packages/enzyme-adapter-react-15/src/ReactFifteenAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ReactFifteenAdapter extends EnzymeAdapter {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -134,7 +135,7 @@ class ReactFifteenAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = ReactDOM.render(wrappedEl, domNode);
if (typeof callback === 'function') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class ReactSixteenOneAdapter extends EnzymeAdapter {
const { attachTo, hydrateIn } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -197,7 +198,7 @@ class ReactSixteenOneAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = hydrateIn
? ReactDOM.hydrate(wrappedEl, domNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class ReactSixteenTwoAdapter extends EnzymeAdapter {
const { attachTo, hydrateIn } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -199,7 +200,7 @@ class ReactSixteenTwoAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = hydrateIn
? ReactDOM.hydrate(wrappedEl, domNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class ReactSixteenThreeAdapter extends EnzymeAdapter {
const { attachTo, hydrateIn } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -205,7 +206,7 @@ class ReactSixteenThreeAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = hydrateIn
? ReactDOM.hydrate(wrappedEl, domNode)
Expand Down
3 changes: 2 additions & 1 deletion packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class ReactSixteenAdapter extends EnzymeAdapter {
const { attachTo, hydrateIn } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
Expand All @@ -205,7 +206,7 @@ class ReactSixteenAdapter extends EnzymeAdapter {
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = hydrateIn
? ReactDOM.hydrate(wrappedEl, domNode)
Expand Down

0 comments on commit b396e5c

Please sign in to comment.