@samitouri / QOS-React-2 / commits / 957fbc92b1

react-create-class -> create-react-class

Andrew Clark committed Apr 7, 2017 at 15:17 UTC 957fbc92b123030c389bf8b4b874522bdf2db72c
6 files changed +33 -43
package.json
+1
@@ -43,6 +43,7 @@
43 "coffee-script": "^1.8.0",
44 "core-js": "^2.2.1",
45 "coveralls": "^2.11.6",
46 + "create-react-class": "^15.5.0",
47 "del": "^2.0.2",
48 "derequire": "^2.0.3",
49 "escape-string-regexp": "^1.0.5",
scripts/fiber/tests-passing.txt
+1 -1
@@ -90,7 +90,7 @@ src/isomorphic/classic/__tests__/ReactContextValidator-test.js
90 * should warn (but not error) if getChildContext method is missing
91 * should pass parent context if getChildContext method is missing
92
93 -src/isomorphic/classic/class/__tests__/react-create-class-integration-test.js
93 +src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js
94 * should throw when `render` is not specified
95 * should copy prop types onto the Constructor
96 * should warn on invalid prop types
src/isomorphic/React.js
+1 -1
@@ -102,7 +102,7 @@ if (__DEV__) {
102 warnedForCreateClass,
103 'React.createClass is no longer supported. Use a plain JavaScript ' +
104 "class instead. If you're not yet ready to migrate, " +
105 - 'react-create-class is available on npm as a temporary, ' +
105 + 'create-react-class is available on npm as a temporary, ' +
106 'drop-in replacement.',
107 );
108 warnedForCreateClass = true;
src/isomorphic/__tests__/React-test.js
+1 -1
@@ -37,7 +37,7 @@ describe('React', () => {
37 expectDev(console.error.calls.argsFor(0)[0]).toContain(
38 'React.createClass is no longer supported. Use a plain ' +
39 "JavaScript class instead. If you're not yet ready to migrate, " +
40 - 'react-create-class is available on npm as a temporary, ' +
40 + 'create-react-class is available on npm as a temporary, ' +
41 'drop-in replacement.',
42 );
43 });
src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js renamed
+23 -34
@@ -14,15 +14,15 @@
14 var React;
15 var ReactDOM;
16 var ReactTestUtils;
17 -var ReactCreateClass;
17 +var createReactClass;
18
19 -describe('react-create-class-integration', () => {
19 +describe('create-react-class-integration', () => {
20 beforeEach(() => {
21 React = require('React');
22 ReactDOM = require('ReactDOM');
23 ReactTestUtils = require('ReactTestUtils');
24 - var ReactCreateClassFactory = require('react-create-class/factory');
25 - ReactCreateClass = ReactCreateClassFactory(
24 + var createReactClassFactory = require('create-react-class/factory');
25 + createReactClass = createReactClassFactory(
26 React.Component,
27 React.isValidElement,
28 require('ReactNoopUpdateQueue'),
@@ -31,26 +31,15 @@ describe('react-create-class-integration', () => {
31
32 it('should throw when `render` is not specified', () => {
33 expect(function() {
34 - ReactCreateClass({});
34 + createReactClass({});
35 }).toThrowError(
36 'createClass(...): Class specification must implement a `render` method.',
37 );
38 });
39
40 - // TODO: Update babel-plugin-transform-react-display-name
41 - xit('should copy `displayName` onto the Constructor', () => {
42 - var TestComponent = ReactCreateClass({
43 - render: function() {
44 - return <div />;
45 - },
46 - });
47 -
48 - expect(TestComponent.displayName).toBe('TestComponent');
49 - });
50 -
40 it('should copy prop types onto the Constructor', () => {
41 var propValidator = jest.fn();
53 - var TestComponent = ReactCreateClass({
42 + var TestComponent = createReactClass({
43 propTypes: {
44 value: propValidator,
45 },
@@ -65,7 +54,7 @@ describe('react-create-class-integration', () => {
54
55 it('should warn on invalid prop types', () => {
56 spyOn(console, 'error');
68 - ReactCreateClass({
57 + createReactClass({
58 displayName: 'Component',
59 propTypes: {
60 prop: null,
@@ -83,7 +72,7 @@ describe('react-create-class-integration', () => {
72
73 it('should warn on invalid context types', () => {
74 spyOn(console, 'error');
86 - ReactCreateClass({
75 + createReactClass({
76 displayName: 'Component',
77 contextTypes: {
78 prop: null,
@@ -101,7 +90,7 @@ describe('react-create-class-integration', () => {
90
91 it('should throw on invalid child context types', () => {
92 spyOn(console, 'error');
104 - ReactCreateClass({
93 + createReactClass({
94 displayName: 'Component',
95 childContextTypes: {
96 prop: null,
@@ -120,7 +109,7 @@ describe('react-create-class-integration', () => {
109 it('should warn when mispelling shouldComponentUpdate', () => {
110 spyOn(console, 'error');
111
123 - ReactCreateClass({
112 + createReactClass({
113 componentShouldUpdate: function() {
114 return false;
115 },
@@ -135,7 +124,7 @@ describe('react-create-class-integration', () => {
124 'because the function is expected to return a value.',
125 );
126
138 - ReactCreateClass({
127 + createReactClass({
128 displayName: 'NamedComponent',
129 componentShouldUpdate: function() {
130 return false;
@@ -154,7 +143,7 @@ describe('react-create-class-integration', () => {
143
144 it('should warn when mispelling componentWillReceiveProps', () => {
145 spyOn(console, 'error');
157 - ReactCreateClass({
146 + createReactClass({
147 componentWillRecieveProps: function() {
148 return false;
149 },
@@ -171,7 +160,7 @@ describe('react-create-class-integration', () => {
160
161 it('should throw if a reserved property is in statics', () => {
162 expect(function() {
174 - ReactCreateClass({
163 + createReactClass({
164 statics: {
165 getDefaultProps: function() {
166 return {
@@ -196,7 +185,7 @@ describe('react-create-class-integration', () => {
185
186 xit('should warn when using deprecated non-static spec keys', () => {
187 spyOn(console, 'error');
199 - ReactCreateClass({
188 + createReactClass({
189 mixins: [{}],
190 propTypes: {
191 foo: React.PropTypes.string,
@@ -231,7 +220,7 @@ describe('react-create-class-integration', () => {
220 });
221
222 it('should support statics', () => {
234 - var Component = ReactCreateClass({
223 + var Component = createReactClass({
224 statics: {
225 abc: 'def',
226 def: 0,
@@ -261,7 +250,7 @@ describe('react-create-class-integration', () => {
250 });
251
252 it('should work with object getInitialState() return values', () => {
264 - var Component = ReactCreateClass({
253 + var Component = createReactClass({
254 getInitialState: function() {
255 return {
256 occupation: 'clown',
@@ -277,7 +266,7 @@ describe('react-create-class-integration', () => {
266 });
267
268 it('renders based on context getInitialState', () => {
280 - var Foo = ReactCreateClass({
269 + var Foo = createReactClass({
270 contextTypes: {
271 className: React.PropTypes.string,
272 },
@@ -289,7 +278,7 @@ describe('react-create-class-integration', () => {
278 },
279 });
280
292 - var Outer = ReactCreateClass({
281 + var Outer = createReactClass({
282 childContextTypes: {
283 className: React.PropTypes.string,
284 },
@@ -308,7 +297,7 @@ describe('react-create-class-integration', () => {
297
298 it('should throw with non-object getInitialState() return values', () => {
299 [['an array'], 'a string', 1234].forEach(function(state) {
311 - var Component = ReactCreateClass({
300 + var Component = createReactClass({
301 getInitialState: function() {
302 return state;
303 },
@@ -326,7 +315,7 @@ describe('react-create-class-integration', () => {
315 });
316
317 it('should work with a null getInitialState() return value', () => {
329 - var Component = ReactCreateClass({
318 + var Component = createReactClass({
319 getInitialState: function() {
320 return null;
321 },
@@ -340,7 +329,7 @@ describe('react-create-class-integration', () => {
329
330 it('should throw when using legacy factories', () => {
331 spyOn(console, 'error');
343 - var Component = ReactCreateClass({
332 + var Component = createReactClass({
333 render() {
334 return <div />;
335 },
@@ -356,7 +345,7 @@ describe('react-create-class-integration', () => {
345
346 it('replaceState and callback works', () => {
347 var ops = [];
359 - var Component = ReactCreateClass({
348 + var Component = createReactClass({
349 getInitialState() {
350 return {step: 0};
351 },
@@ -378,7 +367,7 @@ describe('react-create-class-integration', () => {
367
368 var ops = [];
369 var instance;
381 - var Component = ReactCreateClass({
370 + var Component = createReactClass({
371 displayName: 'MyComponent',
372 log(name) {
373 ops.push(`${name}: ${this.isMounted()}`);
yarn.lock
+6 -6
@@ -1438,6 +1438,12 @@ create-hmac@^1.1.0, create-hmac@^1.1.2:
1438 create-hash "^1.1.0"
1439 inherits "^2.0.1"
1440
1441 +create-react-class@^15.5.0:
1442 + version "15.5.0"
1443 + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.0.tgz#7508ffcad56a0804fb244d6ff70b07648abfe5fb"
1444 + dependencies:
1445 + fbjs "^0.8.9"
1446 +
1447 cross-spawn-async@^2.2.2:
1448 version "2.2.5"
1449 resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc"
@@ -4004,12 +4010,6 @@ rc@^1.1.7:
4010 minimist "^1.2.0"
4011 strip-json-comments "~2.0.1"
4012
4007 -react-create-class@15.5.0-alpha.7:
4008 - version "15.5.0-alpha.7"
4009 - resolved "https://registry.yarnpkg.com/react-create-class/-/react-create-class-15.5.0-alpha.7.tgz#a2bf8846ab0f0e86799e8a2c2346d7a87941a350"
4010 - dependencies:
4011 - fbjs "^0.8.9"
4012 -
4013 read-only-stream@^2.0.0:
4014 version "2.0.0"
4015 resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0"