mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
lint: remove spaces from object braces
This commit is contained in:
@@ -138,7 +138,7 @@ describe('ReactComponentLifeCycle', function() {
|
||||
var container = document.createElement('div');
|
||||
var StatefulComponent = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { };
|
||||
return {};
|
||||
},
|
||||
render: function() {
|
||||
return (
|
||||
|
||||
@@ -303,7 +303,7 @@ describe('ReactCompositeComponent', function() {
|
||||
|
||||
var Component = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { value: 0 };
|
||||
return {value: 0};
|
||||
},
|
||||
render: function() {
|
||||
return <div />;
|
||||
@@ -314,12 +314,12 @@ describe('ReactCompositeComponent', function() {
|
||||
expect(instance.setState).not.toBeDefined();
|
||||
|
||||
instance = React.render(instance, container);
|
||||
instance.setState({ value: 1 });
|
||||
instance.setState({value: 1});
|
||||
|
||||
expect(console.warn.calls.length).toBe(0);
|
||||
|
||||
React.unmountComponentAtNode(container);
|
||||
instance.setState({ value: 2 });
|
||||
instance.setState({value: 2});
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.argsForCall[0][0]).toBe(
|
||||
'Warning: setState(...): Can only update a mounted or ' +
|
||||
@@ -336,11 +336,11 @@ describe('ReactCompositeComponent', function() {
|
||||
|
||||
var Component = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { value: 0 };
|
||||
return {value: 0};
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
expect(() => {
|
||||
this.setState({ value: 2 }, function() {
|
||||
this.setState({value: 2}, function() {
|
||||
cbCalled = true;
|
||||
})
|
||||
}).not.toThrow();
|
||||
@@ -352,7 +352,7 @@ describe('ReactCompositeComponent', function() {
|
||||
|
||||
var instance = React.render(<Component />, container);
|
||||
|
||||
instance.setState({ value: 1 });
|
||||
instance.setState({value: 1});
|
||||
expect(console.warn.calls.length).toBe(0);
|
||||
|
||||
React.unmountComponentAtNode(container);
|
||||
@@ -375,13 +375,13 @@ describe('ReactCompositeComponent', function() {
|
||||
|
||||
instance = React.render(instance, container);
|
||||
expect(function() {
|
||||
instance.setProps({ value: 1 });
|
||||
instance.setProps({value: 1});
|
||||
}).not.toThrow();
|
||||
expect(console.warn.calls.length).toBe(0);
|
||||
|
||||
React.unmountComponentAtNode(container);
|
||||
expect(function() {
|
||||
instance.setProps({ value: 2 });
|
||||
instance.setProps({value: 2});
|
||||
}).not.toThrow();
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
@@ -757,7 +757,7 @@ describe('ReactCompositeComponent', function() {
|
||||
},
|
||||
|
||||
getChildContext: function() {
|
||||
return { foo: this.props.foo };
|
||||
return {foo: this.props.foo};
|
||||
},
|
||||
|
||||
render: function() { return <Parent><Component /></Parent>; }
|
||||
@@ -878,11 +878,11 @@ describe('ReactCompositeComponent', function() {
|
||||
var renders = 0;
|
||||
var Component = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { updated: false };
|
||||
return {updated: false};
|
||||
},
|
||||
componentWillReceiveProps: function(props) {
|
||||
expect(props.update).toBe(1);
|
||||
this.setState({ updated: true });
|
||||
this.setState({updated: true});
|
||||
},
|
||||
render: function() {
|
||||
renders++;
|
||||
|
||||
@@ -26,12 +26,12 @@ describe('ReactCompositeComponentNestedState-state', function() {
|
||||
it('should provide up to date values for props', function() {
|
||||
var ParentComponent = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { color: 'blue' };
|
||||
return {color: 'blue'};
|
||||
},
|
||||
|
||||
handleColor: function(color) {
|
||||
this.props.logger('parent-handleColor', this.state.color);
|
||||
this.setState({ color: color }, function() {
|
||||
this.setState({color: color}, function() {
|
||||
this.props.logger('parent-after-setState', this.state.color);
|
||||
});
|
||||
},
|
||||
@@ -49,7 +49,7 @@ describe('ReactCompositeComponentNestedState-state', function() {
|
||||
var ChildComponent = React.createClass({
|
||||
getInitialState: function() {
|
||||
this.props.logger('getInitialState', this.props.color);
|
||||
return { hue: 'dark ' + this.props.color };
|
||||
return {hue: 'dark ' + this.props.color};
|
||||
},
|
||||
|
||||
handleHue: function(shade, color) {
|
||||
@@ -58,7 +58,7 @@ describe('ReactCompositeComponentNestedState-state', function() {
|
||||
this.setState(function(state, props) {
|
||||
this.props.logger('setState-this', this.state.hue, this.props.color);
|
||||
this.props.logger('setState-args', state.hue, props.color);
|
||||
return { hue: shade + ' ' + props.color }
|
||||
return {hue: shade + ' ' + props.color}
|
||||
}, function() {
|
||||
this.props.logger('after-setState', this.state.hue, this.props.color);
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ describe('ReactCompositeComponent-state', function() {
|
||||
this.peekAtState('before-setState-receiveProps', state);
|
||||
return {color: newProps.nextColor};
|
||||
});
|
||||
this.replaceState({ color: undefined });
|
||||
this.replaceState({color: undefined});
|
||||
this.setState(
|
||||
function(state) {
|
||||
this.peekAtState('before-setState-again-receiveProps', state);
|
||||
|
||||
@@ -267,11 +267,11 @@ describe('ReactIdentity', function() {
|
||||
var TestContainer = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return { swapped: false };
|
||||
return {swapped: false};
|
||||
},
|
||||
|
||||
swap: function() {
|
||||
this.setState({ swapped: true });
|
||||
this.setState({swapped: true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
||||
@@ -353,27 +353,27 @@ describe('ReactInstanceHandles', function() {
|
||||
var parent = renderParentIntoDocument();
|
||||
var ancestors = [
|
||||
// Common ancestor from window to deep element is ''.
|
||||
{ one: null,
|
||||
{one: null,
|
||||
two: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
com: null
|
||||
},
|
||||
// Same as previous - reversed direction.
|
||||
{ one: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
{one: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
two: null,
|
||||
com: null
|
||||
},
|
||||
// Common ancestor from window to shallow id is ''.
|
||||
{ one: parent.refs.P,
|
||||
{one: parent.refs.P,
|
||||
two: null,
|
||||
com: null
|
||||
},
|
||||
// Common ancestor with self is self.
|
||||
{ one: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
{one: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
two: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
com: parent.refs.P_P1_C1.refs.DIV_1
|
||||
},
|
||||
// Common ancestor with self is self - even if topmost DOM.
|
||||
{ one: parent.refs.P, two: parent.refs.P, com: parent.refs.P },
|
||||
{one: parent.refs.P, two: parent.refs.P, com: parent.refs.P},
|
||||
// Siblings
|
||||
{
|
||||
one: parent.refs.P_P1_C1.refs.DIV_1,
|
||||
|
||||
@@ -30,11 +30,11 @@ describe('ReactMockedComponent', function() {
|
||||
|
||||
OriginalComponent = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return { bar: 'baz' };
|
||||
return {bar: 'baz'};
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return { foo: 'bar' };
|
||||
return {foo: 'bar'};
|
||||
},
|
||||
|
||||
hasCustomMethod: function() {
|
||||
@@ -65,11 +65,11 @@ describe('ReactMockedComponent', function() {
|
||||
var Wrapper = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return { foo: 1 };
|
||||
return {foo: 1};
|
||||
},
|
||||
|
||||
update: function() {
|
||||
this.setState({ foo: 2 });
|
||||
this.setState({foo: 2});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@@ -105,11 +105,11 @@ describe('ReactMockedComponent', function() {
|
||||
var Wrapper = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return { foo: 1 };
|
||||
return {foo: 1};
|
||||
},
|
||||
|
||||
update: function() {
|
||||
this.setState({ foo: 2 });
|
||||
this.setState({foo: 2});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
||||
@@ -51,7 +51,7 @@ var getOriginalKey = function(childName) {
|
||||
*/
|
||||
var StatusDisplay = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { internalState: Math.random() };
|
||||
return {internalState: Math.random()};
|
||||
},
|
||||
|
||||
getStatus: function() {
|
||||
@@ -251,7 +251,7 @@ describe('ReactMultiChildReconcile', function() {
|
||||
var startingInternalState = statusDisplays.jcw.getInternalState();
|
||||
|
||||
// Now remove the child.
|
||||
parentInstance.replaceProps({ usernameToStatus: {} });
|
||||
parentInstance.replaceProps({usernameToStatus: {} });
|
||||
statusDisplays = parentInstance.getStatusDisplays();
|
||||
expect(statusDisplays.jcw).toBeFalsy();
|
||||
|
||||
@@ -271,7 +271,7 @@ describe('ReactMultiChildReconcile', function() {
|
||||
bob: 'bobStatus'
|
||||
};
|
||||
|
||||
testPropsSequence([ { usernameToStatus: usernameToStatus } ]);
|
||||
testPropsSequence([ {usernameToStatus: usernameToStatus} ]);
|
||||
});
|
||||
|
||||
it('should preserve order if children order has not changed', function() {
|
||||
@@ -294,7 +294,7 @@ describe('ReactMultiChildReconcile', function() {
|
||||
|
||||
it('should transition from zero to one children correctly', function() {
|
||||
var PROPS_SEQUENCE = [
|
||||
{ usernameToStatus: {} },
|
||||
{usernameToStatus: {} },
|
||||
{
|
||||
usernameToStatus: {
|
||||
first: 'firstStatus'
|
||||
@@ -311,7 +311,7 @@ describe('ReactMultiChildReconcile', function() {
|
||||
first: 'firstStatus'
|
||||
}
|
||||
},
|
||||
{ usernameToStatus: {} }
|
||||
{usernameToStatus: {} }
|
||||
];
|
||||
testPropsSequence(PROPS_SEQUENCE);
|
||||
});
|
||||
@@ -323,13 +323,13 @@ describe('ReactMultiChildReconcile', function() {
|
||||
first: 'firstStatus'
|
||||
}
|
||||
},
|
||||
{ }
|
||||
{}
|
||||
]);
|
||||
});
|
||||
|
||||
it('should transition from null children to one child', function() {
|
||||
testPropsSequence([
|
||||
{ },
|
||||
{},
|
||||
{
|
||||
usernameToStatus: {
|
||||
first: 'firstStatus'
|
||||
@@ -341,17 +341,17 @@ describe('ReactMultiChildReconcile', function() {
|
||||
it('should transition from zero children to null children', function() {
|
||||
testPropsSequence([
|
||||
{
|
||||
usernameToStatus: { }
|
||||
usernameToStatus: {}
|
||||
},
|
||||
{ }
|
||||
{}
|
||||
]);
|
||||
});
|
||||
|
||||
it('should transition from null children to zero children', function() {
|
||||
testPropsSequence([
|
||||
{ },
|
||||
{},
|
||||
{
|
||||
usernameToStatus: { }
|
||||
usernameToStatus: {}
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -858,7 +858,7 @@ describe('ReactUpdates', function() {
|
||||
|
||||
var B = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { updates: 0 };
|
||||
return {updates: 0};
|
||||
},
|
||||
componentDidMount: function() {
|
||||
componentB = this;
|
||||
@@ -871,7 +871,7 @@ describe('ReactUpdates', function() {
|
||||
|
||||
var A = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { showB: true };
|
||||
return {showB: true};
|
||||
},
|
||||
render: function() {
|
||||
return this.state.showB ? <B /> : <div />;
|
||||
@@ -883,8 +883,8 @@ describe('ReactUpdates', function() {
|
||||
ReactUpdates.batchedUpdates(function() {
|
||||
// B will have scheduled an update but the batching should ensure that its
|
||||
// update never fires.
|
||||
componentB.setState({ updates: 1 });
|
||||
component.setState({ showB: false });
|
||||
componentB.setState({updates: 1});
|
||||
component.setState({showB: false});
|
||||
});
|
||||
|
||||
expect(renderCount).toBe(1);
|
||||
|
||||
@@ -166,7 +166,7 @@ describe('ref swapping', function() {
|
||||
return {count: 0};
|
||||
},
|
||||
moveRef: function() {
|
||||
this.setState({ count: this.state.count + 1 });
|
||||
this.setState({count: this.state.count + 1});
|
||||
},
|
||||
render: function() {
|
||||
var count = this.state.count;
|
||||
|
||||
Reference in New Issue
Block a user