Skip to content

Commit

Permalink
react-create-class -> create-react-class
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Apr 7, 2017
1 parent 1c113d4 commit ed00197
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 42 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"coffee-script": "^1.8.0",
"core-js": "^2.2.1",
"coveralls": "^2.11.6",
"create-react-class": "^15.5.0",
"del": "^2.0.2",
"derequire": "^2.0.3",
"escape-string-regexp": "^1.0.5",
Expand Down
2 changes: 1 addition & 1 deletion scripts/fiber/tests-passing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ src/isomorphic/classic/__tests__/ReactContextValidator-test.js
* should warn (but not error) if getChildContext method is missing
* should pass parent context if getChildContext method is missing

src/isomorphic/classic/class/__tests__/react-create-class-integration-test.js
src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js
* should throw when `render` is not specified
* should copy prop types onto the Constructor
* should warn on invalid prop types
Expand Down
2 changes: 1 addition & 1 deletion src/isomorphic/__tests__/React-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('React', () => {
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'React.createClass is no longer supported. Use a plain ' +
"JavaScript class instead. If you're not yet ready to migrate, " +
'react-create-class is available on npm as a temporary, ' +
'create-react-class is available on npm as a temporary, ' +
'drop-in replacement.',
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
var React;
var ReactDOM;
var ReactTestUtils;
var ReactCreateClass;
var createReactClass;

describe('react-create-class-integration', () => {
describe('create-react-class-integration', () => {
beforeEach(() => {
React = require('React');
ReactDOM = require('ReactDOM');
ReactTestUtils = require('ReactTestUtils');
var ReactCreateClassFactory = require('react-create-class/factory');
ReactCreateClass = ReactCreateClassFactory(
var createReactClassFactory = require('create-react-class/factory');
createReactClass = createReactClassFactory(
React.Component,
React.isValidElement,
require('ReactNoopUpdateQueue'),
Expand All @@ -31,26 +31,15 @@ describe('react-create-class-integration', () => {

it('should throw when `render` is not specified', () => {
expect(function() {
ReactCreateClass({});
createReactClass({});
}).toThrowError(
'createClass(...): Class specification must implement a `render` method.',
);
});

// TODO: Update babel-plugin-transform-react-display-name
xit('should copy `displayName` onto the Constructor', () => {
var TestComponent = ReactCreateClass({
render: function() {
return <div />;
},
});

expect(TestComponent.displayName).toBe('TestComponent');
});

it('should copy prop types onto the Constructor', () => {
var propValidator = jest.fn();
var TestComponent = ReactCreateClass({
var TestComponent = createReactClass({
propTypes: {
value: propValidator,
},
Expand All @@ -65,7 +54,7 @@ describe('react-create-class-integration', () => {

it('should warn on invalid prop types', () => {
spyOn(console, 'error');
ReactCreateClass({
createReactClass({
displayName: 'Component',
propTypes: {
prop: null,
Expand All @@ -83,7 +72,7 @@ describe('react-create-class-integration', () => {

it('should warn on invalid context types', () => {
spyOn(console, 'error');
ReactCreateClass({
createReactClass({
displayName: 'Component',
contextTypes: {
prop: null,
Expand All @@ -101,7 +90,7 @@ describe('react-create-class-integration', () => {

it('should throw on invalid child context types', () => {
spyOn(console, 'error');
ReactCreateClass({
createReactClass({
displayName: 'Component',
childContextTypes: {
prop: null,
Expand All @@ -120,7 +109,7 @@ describe('react-create-class-integration', () => {
it('should warn when mispelling shouldComponentUpdate', () => {
spyOn(console, 'error');

ReactCreateClass({
createReactClass({
componentShouldUpdate: function() {
return false;
},
Expand All @@ -135,7 +124,7 @@ describe('react-create-class-integration', () => {
'because the function is expected to return a value.',
);

ReactCreateClass({
createReactClass({
displayName: 'NamedComponent',
componentShouldUpdate: function() {
return false;
Expand All @@ -154,7 +143,7 @@ describe('react-create-class-integration', () => {

it('should warn when mispelling componentWillReceiveProps', () => {
spyOn(console, 'error');
ReactCreateClass({
createReactClass({
componentWillRecieveProps: function() {
return false;
},
Expand All @@ -171,7 +160,7 @@ describe('react-create-class-integration', () => {

it('should throw if a reserved property is in statics', () => {
expect(function() {
ReactCreateClass({
createReactClass({
statics: {
getDefaultProps: function() {
return {
Expand All @@ -196,7 +185,7 @@ describe('react-create-class-integration', () => {

xit('should warn when using deprecated non-static spec keys', () => {
spyOn(console, 'error');
ReactCreateClass({
createReactClass({
mixins: [{}],
propTypes: {
foo: React.PropTypes.string,
Expand Down Expand Up @@ -231,7 +220,7 @@ describe('react-create-class-integration', () => {
});

it('should support statics', () => {
var Component = ReactCreateClass({
var Component = createReactClass({
statics: {
abc: 'def',
def: 0,
Expand Down Expand Up @@ -261,7 +250,7 @@ describe('react-create-class-integration', () => {
});

it('should work with object getInitialState() return values', () => {
var Component = ReactCreateClass({
var Component = createReactClass({
getInitialState: function() {
return {
occupation: 'clown',
Expand All @@ -277,7 +266,7 @@ describe('react-create-class-integration', () => {
});

it('renders based on context getInitialState', () => {
var Foo = ReactCreateClass({
var Foo = createReactClass({
contextTypes: {
className: React.PropTypes.string,
},
Expand All @@ -289,7 +278,7 @@ describe('react-create-class-integration', () => {
},
});

var Outer = ReactCreateClass({
var Outer = createReactClass({
childContextTypes: {
className: React.PropTypes.string,
},
Expand All @@ -308,7 +297,7 @@ describe('react-create-class-integration', () => {

it('should throw with non-object getInitialState() return values', () => {
[['an array'], 'a string', 1234].forEach(function(state) {
var Component = ReactCreateClass({
var Component = createReactClass({
getInitialState: function() {
return state;
},
Expand All @@ -326,7 +315,7 @@ describe('react-create-class-integration', () => {
});

it('should work with a null getInitialState() return value', () => {
var Component = ReactCreateClass({
var Component = createReactClass({
getInitialState: function() {
return null;
},
Expand All @@ -340,7 +329,7 @@ describe('react-create-class-integration', () => {

it('should throw when using legacy factories', () => {
spyOn(console, 'error');
var Component = ReactCreateClass({
var Component = createReactClass({
render() {
return <div />;
},
Expand All @@ -356,7 +345,7 @@ describe('react-create-class-integration', () => {

it('replaceState and callback works', () => {
var ops = [];
var Component = ReactCreateClass({
var Component = createReactClass({
getInitialState() {
return {step: 0};
},
Expand All @@ -378,7 +367,7 @@ describe('react-create-class-integration', () => {

var ops = [];
var instance;
var Component = ReactCreateClass({
var Component = createReactClass({
displayName: 'MyComponent',
log(name) {
ops.push(`${name}: ${this.isMounted()}`);
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,12 @@ create-hmac@^1.1.0, create-hmac@^1.1.2:
create-hash "^1.1.0"
inherits "^2.0.1"

create-react-class@^15.5.0:
version "15.5.0"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.0.tgz#7508ffcad56a0804fb244d6ff70b07648abfe5fb"
dependencies:
fbjs "^0.8.9"

cross-spawn-async@^2.2.2:
version "2.2.5"
resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc"
Expand Down Expand Up @@ -4004,12 +4010,6 @@ rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-create-class@15.5.0-alpha.7:
version "15.5.0-alpha.7"
resolved "https://registry.yarnpkg.com/react-create-class/-/react-create-class-15.5.0-alpha.7.tgz#a2bf8846ab0f0e86799e8a2c2346d7a87941a350"
dependencies:
fbjs "^0.8.9"

read-only-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0"
Expand Down

0 comments on commit ed00197

Please sign in to comment.