diff --git a/README.md b/README.md
index 43a3f134f..c333aee36 100644
--- a/README.md
+++ b/README.md
@@ -64,15 +64,14 @@ If you are using `React 0.14` or `React <15.5`, in addition to `enzyme`, you wil
you also have the following npm modules installed if they were not already:
```bash
-npm i --save-dev react-addons-test-utils
-npm i --save-dev react-dom
+npm i --save-dev react-addons-test-utils react-dom
```
If you are using `React >=15.5`, in addition to `enzyme`, you will have to ensure that you also have
the following npm modules installed if they were not already:
```bash
-npm i --save-dev react-dom
+npm i --save-dev react-dom create-react-class
```
diff --git a/test/ReactWrapper-spec.jsx b/test/ReactWrapper-spec.jsx
index ab9370e40..53bdecb4d 100644
--- a/test/ReactWrapper-spec.jsx
+++ b/test/ReactWrapper-spec.jsx
@@ -4,7 +4,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { expect } from 'chai';
import sinon from 'sinon';
-import { batchedUpdates } from '../src/react-compat';
+import { batchedUpdates, createClass } from '../src/react-compat';
import {
describeWithDOM,
@@ -24,7 +24,7 @@ import { REACT013, REACT014, REACT15 } from '../src/version';
describeWithDOM('mount', () => {
describe('context', () => {
it('can pass in context', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -39,7 +39,7 @@ describeWithDOM('mount', () => {
});
it('can pass context to the child of mounted component', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -47,7 +47,7 @@ describeWithDOM('mount', () => {
return
{this.context.name}
;
},
});
- const ComplexComponent = React.createClass({
+ const ComplexComponent = createClass({
render() {
return
;
},
@@ -62,7 +62,7 @@ describeWithDOM('mount', () => {
});
it('should not throw if context is passed in but contextTypes is missing', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
render() {
return {this.context.name}
;
},
@@ -73,7 +73,7 @@ describeWithDOM('mount', () => {
});
it('is instrospectable through context API', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -1097,7 +1097,7 @@ describeWithDOM('mount', () => {
describe('.setContext(newContext)', () => {
it('should set context for a component multiple times', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -1116,7 +1116,7 @@ describeWithDOM('mount', () => {
});
it('should throw if it is called when shallow didn’t include context', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -1467,7 +1467,7 @@ describeWithDOM('mount', () => {
const emptyRenderValues = generateEmptyRenderData();
itWithData(emptyRenderValues, 'when a React class component returns: ', (data) => {
- const Foo = React.createClass({
+ const Foo = createClass({
render() {
return data.value;
},
@@ -3268,9 +3268,9 @@ describeWithDOM('mount', () => {
});
});
- describe('React.createClass', () => {
+ describe('createClass', () => {
it('should return the name of the node', () => {
- const Foo = React.createClass({
+ const Foo = createClass({
displayName: 'CustomWrapper',
render() {
return ;
@@ -3304,9 +3304,9 @@ describeWithDOM('mount', () => {
});
});
- describe('React.createClass', () => {
+ describe('createClass', () => {
it('should return the name of the node', () => {
- const Foo = React.createClass({
+ const Foo = createClass({
render() {
return ;
},
diff --git a/test/ShallowWrapper-spec.jsx b/test/ShallowWrapper-spec.jsx
index 3afeb3b1b..f474ad1c2 100644
--- a/test/ShallowWrapper-spec.jsx
+++ b/test/ShallowWrapper-spec.jsx
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { expect } from 'chai';
import sinon from 'sinon';
+import { createClass } from '../src/react-compat';
import { shallow, render, ShallowWrapper } from '../src/';
import { describeIf, itIf, itWithData, generateEmptyRenderData } from './_helpers';
import { ITERATOR_SYMBOL, withSetStateAllowed } from '../src/Utils';
@@ -11,7 +12,7 @@ import { REACT013, REACT014, REACT15 } from '../src/version';
describe('shallow', () => {
describe('context', () => {
it('can pass in context', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -26,7 +27,7 @@ describe('shallow', () => {
});
it('should not throw if context is passed in but contextTypes is missing', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
render() {
return {this.context.name}
;
},
@@ -37,7 +38,7 @@ describe('shallow', () => {
});
it('is instrospectable through context API', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -952,7 +953,7 @@ describe('shallow', () => {
});
describe('.setContext(newContext)', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -1272,7 +1273,7 @@ describe('shallow', () => {
const emptyRenderValues = generateEmptyRenderData();
itWithData(emptyRenderValues, 'when a React class component returns: ', (data) => {
- const Foo = React.createClass({
+ const Foo = createClass({
render() {
return data.value;
},
@@ -3907,15 +3908,15 @@ describe('shallow', () => {
});
});
- describe('React.createClass', () => {
+ describe('createClass', () => {
it('should return the name of the node', () => {
- const Foo = React.createClass({
+ const Foo = createClass({
displayName: 'CustomWrapper',
render() {
return ;
},
});
- const Wrapper = React.createClass({
+ const Wrapper = createClass({
render() {
return ;
},
@@ -3953,14 +3954,14 @@ describe('shallow', () => {
});
});
- describe('React.createClass', () => {
+ describe('createClass', () => {
it('should return the name of the node', () => {
- const Foo = React.createClass({
+ const Foo = createClass({
render() {
return ;
},
});
- const Wrapper = React.createClass({
+ const Wrapper = createClass({
render() {
return ;
},
diff --git a/test/staticRender-spec.jsx b/test/staticRender-spec.jsx
index 4fa4f4a64..4ebe74c4f 100644
--- a/test/staticRender-spec.jsx
+++ b/test/staticRender-spec.jsx
@@ -4,11 +4,12 @@ import { expect } from 'chai';
import { describeWithDOM, describeIf } from './_helpers';
import { render } from '../src/';
import { REACT013 } from '../src/version';
+import { createClass } from '../src/react-compat';
describeWithDOM('render', () => {
describeIf(!REACT013, 'context', () => {
it('can pass in context', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -22,7 +23,7 @@ describeWithDOM('render', () => {
expect(wrapper.text()).to.equal('foo');
});
it('can pass context to the child of mounted component', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
contextTypes: {
name: PropTypes.string,
},
@@ -30,7 +31,7 @@ describeWithDOM('render', () => {
return {this.context.name}
;
},
});
- const ComplexComponent = React.createClass({
+ const ComplexComponent = createClass({
render() {
return
;
},
@@ -45,7 +46,7 @@ describeWithDOM('render', () => {
expect(wrapper.children().first().text()).to.equal('foo');
});
it('should not throw if context is passed in but contextTypes is missing', () => {
- const SimpleComponent = React.createClass({
+ const SimpleComponent = createClass({
render() {
return {this.context.name}
;
},