Skip to content

Commit f4b25a3

Browse files
committed
Add variable-assignment tests for create-react-class
1 parent c8eb10d commit f4b25a3

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

test/fixtures/variable-assignment/actual.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ const FooExported = () => (
6363
);
6464

6565
FooExported.propTypes = propTypesExported;
66+
67+
const propTypesCreateClass = { foo: PropTypes.string };
68+
const FooCreateClass = createReactClass({
69+
propTypes: propTypesCreateClass
70+
});

test/fixtures/variable-assignment/expected-remove-es5.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ exports.propTypesExported = propTypesExported;
3939
var FooExported = function FooExported() {
4040
return React.createElement("div", null);
4141
};
42+
43+
var FooCreateClass = createReactClass({
44+
displayName: "FooCreateClass"
45+
});

test/fixtures/variable-assignment/expected-remove-es6.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ export const propTypesExported = {
1717
};
1818

1919
const FooExported = () => <div />;
20+
21+
const FooCreateClass = createReactClass({});

test/fixtures/variable-assignment/expected-wrap-es5.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ var FooExported = function FooExported() {
6666
};
6767

6868
FooExported.propTypes = process.env.NODE_ENV !== "production" ? propTypesExported : {};
69-
69+
var propTypesCreateClass = process.env.NODE_ENV !== "production" ? {
70+
foo: PropTypes.string
71+
} : {};;
72+
var FooCreateClass = createReactClass({
73+
displayName: "FooCreateClass",
74+
propTypes: propTypesCreateClass
75+
});

test/fixtures/variable-assignment/expected-wrap-es6.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ export const propTypesExported = {
4545
const FooExported = () => <div />;
4646

4747
FooExported.propTypes = process.env.NODE_ENV !== "production" ? propTypesExported : {};
48+
const propTypesCreateClass = process.env.NODE_ENV !== "production" ? {
49+
foo: PropTypes.string
50+
} : {};;
51+
const FooCreateClass = createReactClass({
52+
propTypes: propTypesCreateClass
53+
});

0 commit comments

Comments
 (0)