Skip to content

Commit 2818302

Browse files
committed
Update test components to use ComponentDidMount due to React 16.9 deprecations
1 parent 5a6c27b commit 2818302

File tree

14 files changed

+243
-49
lines changed

14 files changed

+243
-49
lines changed

test/dummy_sprockets/app/assets/javascripts/components/TodoList.js.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ TodoList = createReactClass({
22
getInitialState: function() {
33
return({mounted: "nope"});
44
},
5-
componentWillMount: function() {
5+
componentDidMount: function() {
66
this.setState({mounted: 'yep'});
77
},
88
render: function() {

test/dummy_sprockets/app/assets/javascripts/components/TodoListWithConsoleLog.js.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TodoListWithConsoleLog = createReactClass({
33
console.log('got initial state');
44
return({mounted: "nope"});
55
},
6-
componentWillMount: function() {
6+
componentDidMount: function() {
77
console.warn('mounted component');
88
this.setState({mounted: 'yep'});
99
},

test/dummy_sprockets/app/assets/javascripts/components/WithSetTimeout.js.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
WithSetTimeout = createReactClass({
2-
componentWillMount: function () {
2+
componentDidMount: function () {
33
setTimeout(function () {}, 1000)
44
clearTimeout(0)
55
},

test/dummy_webpacker1/app/javascript/components/TodoList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = createReactClass({
55
getInitialState: function() {
66
return({mounted: "nope"});
77
},
8-
componentWillMount: function() {
8+
componentDidMount: function() {
99
this.setState({mounted: 'yep'});
1010
},
1111
render: function() {

test/dummy_webpacker1/app/javascript/components/TodoListWithConsoleLog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = createReactClass({
66
console.log('got initial state');
77
return({mounted: "nope"});
88
},
9-
componentWillMount: function() {
9+
componentDidMount: function() {
1010
console.warn('mounted component');
1111
this.setState({mounted: 'yep'});
1212
},

test/dummy_webpacker1/app/javascript/components/WithSetTimeout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require("react")
22
var createReactClass = require("create-react-class")
33

44
module.exports = createReactClass({
5-
componentWillMount: function () {
5+
componentDidMount: function () {
66
setTimeout(function () {}, 1000)
77
clearTimeout(0)
88
},

test/dummy_webpacker2/app/javascript/components/TodoList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = createReactClass({
55
getInitialState: function() {
66
return({mounted: "nope"});
77
},
8-
componentWillMount: function() {
8+
componentDidMount: function() {
99
this.setState({mounted: 'yep'});
1010
},
1111
render: function() {

test/dummy_webpacker2/app/javascript/components/TodoListWithConsoleLog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = createReactClass({
66
console.log('got initial state');
77
return({mounted: "nope"});
88
},
9-
componentWillMount: function() {
9+
componentDidMount: function() {
1010
console.warn('mounted component');
1111
this.setState({mounted: 'yep'});
1212
},

test/dummy_webpacker2/app/javascript/components/WithSetTimeout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require("react")
22
var createReactClass = require("create-react-class")
33

44
module.exports = createReactClass({
5-
componentWillMount: function () {
5+
componentDidMount: function () {
66
setTimeout(function () {}, 1000)
77
clearTimeout(0)
88
},

test/dummy_webpacker3/app/javascript/components/TodoList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = createReactClass({
55
getInitialState: function() {
66
return({mounted: "nope"});
77
},
8-
componentWillMount: function() {
8+
componentDidMount: function() {
99
this.setState({mounted: 'yep'});
1010
},
1111
render: function() {

test/dummy_webpacker3/app/javascript/components/TodoListWithConsoleLog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = createReactClass({
66
console.log('got initial state');
77
return({mounted: "nope"});
88
},
9-
componentWillMount: function() {
9+
componentDidMount: function() {
1010
console.warn('mounted component');
1111
this.setState({mounted: 'yep'});
1212
},

test/dummy_webpacker3/app/javascript/components/WithSetTimeout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require("react")
22
var createReactClass = require("create-react-class")
33

44
module.exports = createReactClass({
5-
componentWillMount: function () {
5+
componentDidMount: function () {
66
setTimeout(function () {}, 1000)
77
clearTimeout(0)
88
},

test/dummy_webpacker3/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"prop-types": "^15.6.0",
77
"react": "^16.0.0",
88
"react-dom": "^16.0.0",
9-
"react_ujs": "^2.2.1"
9+
"react_ujs": "^2.2.1",
10+
"webpack-cli": "^3.3.6"
1011
},
1112
"devDependencies": {
1213
"webpack-dev-server": "^3.1.11"

0 commit comments

Comments
 (0)