spec: convert createClass to es6 classes in /spec

npx jscodeshift -t ../react-codemod/transforms/class.js spec

Change-Id: I07f29d8e1fd319ea6b3f38a36c938e3d160bcba5
Reviewed-on: https://gerrit.instructure.com/163915
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
Ryan Shaw 2018-09-10 22:36:24 -06:00
parent ba99a574c6
commit 1d5a3683e5
2 changed files with 12 additions and 10 deletions

View File

@ -38,19 +38,21 @@ export default function stubRouterContext(Component, props, stubs) {
},
stubs
)
return React.createClass({
childContextTypes: {
return class extends React.Component {
static childContextTypes = {
router: PropTypes.func,
routeDepth: PropTypes.number
},
};
getChildContext() {
return {
router: RouterStub,
routeDepth: 0
}
},
}
render() {
return <Component {...props} />
}
})
};
}

View File

@ -24,14 +24,14 @@ import FileUploader from 'compiled/react_files/modules/FileUploader'
QUnit.module('UploadProgress', {
setup() {
const ProgressContainer = React.createClass({
getInitialState() {
return {uploader: this.props.uploader}
},
class ProgressContainer extends React.Component {
state = {uploader: this.props.uploader};
render() {
return <UploadProgress ref="prog" uploader={this.state.uploader} />
}
})
}
this.uploader = this.mockUploader('filename', 35)
this.node = $('<div>').appendTo('#fixtures')[0]
this.progressContainer = ReactDOM.render(