Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Fix errors from react update (#1159)
Browse files Browse the repository at this point in the history
* update use of createClass for React v15.5

* Update location of shallow renderer

The 'shallow' renderer was moved in React v15.5, and updating this
quiets a warning about it.

**issue:**
#1157
  • Loading branch information
flarnie authored Apr 22, 2017
1 parent 3c91df4 commit 832cb68
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"jest": "^15.1.1",
"react": "^15.0.0-rc.1",
"react-dom": "^15.0.0-rc.1",
"react-test-renderer": "^15.5.4",
"run-sequence": "^1.1.2",
"through2": "^2.0.1",
"vinyl-buffer": "^1.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/component/base/__tests__/DraftEditor.react-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@

jest
.unmock('DraftEditor.react')
.unmock('react-test-renderer/shallow')
.unmock('generateRandomKey');

var React = require('React');
var ReactTestUtils = require('ReactTestUtils');
var ReactShallowRenderer = require('react-test-renderer/shallow');

var DraftEditor = require('DraftEditor.react');

describe('DraftEditor.react', () => {
var shallow;

beforeEach(function() {
shallow = ReactTestUtils.createRenderer();
shallow = new ReactShallowRenderer();
});

describe('Basic rendering', () => {
Expand Down
17 changes: 9 additions & 8 deletions src/component/contents/__tests__/DraftEditorBlock.react-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ var {BOLD, NONE, ITALIC} = SampleDraftInlineStyle;

var mockGetDecorations = jest.fn();

var DecoratorSpan = React.createClass({
class DecoratorSpan extends React.Component {
render() {
return <span>{this.props.children}</span>;
},
});
}
}

var DraftEditorBlock = require('DraftEditorBlock.react');

Expand All @@ -61,13 +61,14 @@ class Decorator {
}

var mockLeafRender = jest.fn(() => <span />);
class MockEditorLeaf extends React.Component {
render() {
return mockLeafRender();
}
}
jest.setMock(
'DraftEditorLeaf.react',
React.createClass({
render: function() {
return mockLeafRender();
},
}),
MockEditorLeaf,
);

var DraftEditorLeaf = require('DraftEditorLeaf.react');
Expand Down

0 comments on commit 832cb68

Please sign in to comment.