Skip to content

Commit 2c5b461

Browse files
author
Keyan Zhang
committed
added a failing test
1 parent eacb1e1 commit 2c5b461

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

transforms/__testfixtures__/property-initializer-test2.output.js renamed to transforms/__testfixtures__/property-initializer-2.output.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ var React = require('React');
44

55
// Comment
66
module.exports = class extends React.Component {
7+
static propTypes = {
8+
foo: React.PropTypes.bool,
9+
};
10+
711
constructor(props, context) {
812
super(props, context);
913

@@ -16,7 +20,3 @@ module.exports = class extends React.Component {
1620
return <div />;
1721
}
1822
};
19-
20-
module.exports.propTypes = {
21-
foo: React.PropTypes.bool,
22-
};

transforms/__testfixtures__/property-initializer.input.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var MyComponent = React.createClass({
1616
};
1717
},
1818

19-
foo: function() {
19+
foo: function(): void {
2020
this.setState({heyoo: 24});
2121
},
2222
});
@@ -26,7 +26,7 @@ var MyComponent2 = React.createClass({
2626
getDefaultProps: function() {
2727
return {a: 1};
2828
},
29-
foo: function() {
29+
foo: function(): void {
3030
pass(this.foo);
3131
this.forceUpdate();
3232
},
@@ -35,7 +35,7 @@ var MyComponent2 = React.createClass({
3535
var MyComponent3 = React.createClass({
3636
statics: {
3737
someThing: 10,
38-
foo: function() {},
38+
funcThatDoesNothing: function(): void {},
3939
},
4040
propTypes: {
4141
highlightEntities: React.PropTypes.bool,
@@ -47,7 +47,7 @@ var MyComponent3 = React.createClass({
4747
},
4848

4949
getDefaultProps: function() {
50-
foo();
50+
unboundFunc();
5151
return {
5252
linkifyEntities: true,
5353
highlightEntities: false,
@@ -61,11 +61,11 @@ var MyComponent3 = React.createClass({
6161
};
6262
},
6363

64-
_renderText: function(text) {
64+
_renderText: function(text: string): ReactElement<any> {
6565
return <Text text={text} />;
6666
},
6767

68-
_renderImageRange: function(text, range) {
68+
_renderImageRange: function(text: string, range): ReactElement<any> {
6969
var image = range.image;
7070
if (image) {
7171
return (
@@ -79,10 +79,10 @@ var MyComponent3 = React.createClass({
7979
},
8080

8181
autobindMe: function() {},
82-
dontAutobindMe: function() {},
82+
dontAutobindMe: function(): number { return 12; },
8383

8484
// Function comment
85-
_renderRange: function(text, range) {
85+
_renderRange: function(text: string, range, bla: Promise<string>): ReactElement<any> {
8686
var self = this;
8787

8888
self.dontAutobindMe();

transforms/__testfixtures__/property-initializer.output.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MyComponent extends React.Component {
1818
};
1919
}
2020

21-
foo() {
21+
foo(): void {
2222
this.setState({heyoo: 24});
2323
}
2424
}
@@ -30,7 +30,7 @@ class MyComponent2 extends React.Component {
3030
this.foo = this.foo.bind(this);
3131
}
3232

33-
foo() {
33+
foo(): void {
3434
pass(this.foo);
3535
this.forceUpdate();
3636
}
@@ -51,11 +51,11 @@ class MyComponent3 extends React.Component {
5151
};
5252
}
5353

54-
_renderText(text) {
54+
_renderText(text: string): ReactElement<any> {
5555
return <Text text={text} />;
5656
}
5757

58-
_renderImageRange(text, range) {
58+
_renderImageRange(text: string, range): ReactElement<any> {
5959
var image = range.image;
6060
if (image) {
6161
return (
@@ -69,10 +69,10 @@ class MyComponent3 extends React.Component {
6969
}
7070

7171
autobindMe() {}
72-
dontAutobindMe() {}
72+
dontAutobindMe(): number { return 12; }
7373

7474
// Function comment
75-
_renderRange(text, range) {
75+
_renderRange(text: string, range, bla: Promise<string>): ReactElement<any> {
7676
var self = this;
7777

7878
self.dontAutobindMe();
@@ -112,14 +112,14 @@ class MyComponent3 extends React.Component {
112112
}
113113

114114
MyComponent3.defaultProps = function() {
115-
foo();
115+
unboundFunc();
116116
return {
117117
linkifyEntities: true,
118118
highlightEntities: false,
119119
};
120120
}();
121121

122-
MyComponent3.foo = function() {};
122+
MyComponent3.funcThatDoesNothing = function(): void {};
123123

124124
MyComponent3.propTypes = {
125125
highlightEntities: React.PropTypes.bool,

transforms/__tests__/property-initializer-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
'use strict';
1212

1313
const defineTest = require('jscodeshift/dist/testUtils').defineTest;
14-
defineTest(__dirname, 'property-initializer');
15-
defineTest(__dirname, 'property-initializer', null, 'export-default-property-initializer');
14+
// defineTest(__dirname, 'property-initializer');
15+
defineTest(__dirname, 'property-initializer', null, 'property-initializer-2');

0 commit comments

Comments
 (0)