mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
lint: remove spaces from array brackets
This commit is contained in:
@@ -40,7 +40,7 @@ describe('ReactElementValidator', function() {
|
||||
spyOn(console, 'warn');
|
||||
var Component = React.createFactory(ComponentClass);
|
||||
|
||||
Component(null, [ Component(), Component() ]);
|
||||
Component(null, [Component(), Component()]);
|
||||
|
||||
expect(console.warn.argsForCall.length).toBe(1);
|
||||
expect(console.warn.argsForCall[0][0]).toContain(
|
||||
@@ -64,7 +64,7 @@ describe('ReactElementValidator', function() {
|
||||
var ComponentWrapper = React.createClass({
|
||||
displayName: 'ComponentWrapper',
|
||||
render: function() {
|
||||
return InnerComponent({childSet: [ Component(), Component() ] });
|
||||
return InnerComponent({childSet: [Component(), Component()] });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('ReactElementValidator', function() {
|
||||
spyOn(console, 'warn');
|
||||
var Component = React.createFactory(ComponentClass);
|
||||
|
||||
Component(null, [ Component({key: '#1'}), Component({key: '#2'}) ]);
|
||||
Component(null, [Component({key: '#1'}), Component({key: '#2'})]);
|
||||
|
||||
expect(console.warn.argsForCall.length).toBe(0);
|
||||
});
|
||||
|
||||
@@ -291,10 +291,10 @@ describe('ReactComponentLifeCycle', function() {
|
||||
spyOn(console, 'warn');
|
||||
var Component = React.createClass({
|
||||
getInitialState: function() {
|
||||
return { isMounted: false };
|
||||
return {isMounted: false};
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.setState({ isMounted: true });
|
||||
this.setState({isMounted: true});
|
||||
},
|
||||
render: function() {
|
||||
if (this.state.isMounted) {
|
||||
|
||||
@@ -99,17 +99,17 @@ describe('ReactCompositeComponentNestedState-state', function() {
|
||||
);
|
||||
|
||||
expect(logger.mock.calls).toEqual([
|
||||
[ 'parent-render', 'blue' ],
|
||||
[ 'getInitialState', 'blue' ],
|
||||
[ 'render', 'dark blue', 'blue' ],
|
||||
[ 'handleHue', 'dark blue', 'blue' ],
|
||||
[ 'parent-handleColor', 'blue' ],
|
||||
[ 'parent-render', 'green' ],
|
||||
[ 'setState-this', 'dark blue', 'blue' ],
|
||||
[ 'setState-args', 'dark blue', 'green' ],
|
||||
[ 'render', 'light green', 'green' ],
|
||||
[ 'parent-after-setState', 'green' ],
|
||||
[ 'after-setState', 'light green', 'green' ]
|
||||
['parent-render', 'blue'],
|
||||
['getInitialState', 'blue'],
|
||||
['render', 'dark blue', 'blue'],
|
||||
['handleHue', 'dark blue', 'blue'],
|
||||
['parent-handleColor', 'blue'],
|
||||
['parent-render', 'green'],
|
||||
['setState-this', 'dark blue', 'blue'],
|
||||
['setState-args', 'dark blue', 'green'],
|
||||
['render', 'light green', 'green'],
|
||||
['parent-after-setState', 'green'],
|
||||
['after-setState', 'light green', 'green']
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -155,67 +155,67 @@ describe('ReactCompositeComponent-state', function() {
|
||||
|
||||
expect(stateListener.mock.calls).toEqual([
|
||||
// there is no state when getInitialState() is called
|
||||
[ 'getInitialState', null ],
|
||||
[ 'componentWillMount-start', 'red' ],
|
||||
['getInitialState', null],
|
||||
['componentWillMount-start', 'red'],
|
||||
// setState()'s only enqueue pending states.
|
||||
[ 'componentWillMount-after-sunrise', 'red' ],
|
||||
[ 'componentWillMount-end', 'red' ],
|
||||
['componentWillMount-after-sunrise', 'red'],
|
||||
['componentWillMount-end', 'red'],
|
||||
// pending state queue is processed
|
||||
[ 'before-setState-sunrise', 'red' ],
|
||||
[ 'after-setState-sunrise', 'sunrise' ],
|
||||
[ 'after-setState-orange', 'orange' ],
|
||||
['before-setState-sunrise', 'red'],
|
||||
['after-setState-sunrise', 'sunrise'],
|
||||
['after-setState-orange', 'orange'],
|
||||
// pending state has been applied
|
||||
[ 'render', 'orange' ],
|
||||
[ 'componentDidMount-start', 'orange' ],
|
||||
['render', 'orange'],
|
||||
['componentDidMount-start', 'orange'],
|
||||
// setState-sunrise and setState-orange should be called here,
|
||||
// after the bug in #1740
|
||||
// componentDidMount() called setState({color:'yellow'}), which is async.
|
||||
// The update doesn't happen until the next flush.
|
||||
[ 'componentDidMount-end', 'orange' ],
|
||||
[ 'shouldComponentUpdate-currentState', 'orange' ],
|
||||
[ 'shouldComponentUpdate-nextState', 'yellow' ],
|
||||
[ 'componentWillUpdate-currentState', 'orange' ],
|
||||
[ 'componentWillUpdate-nextState', 'yellow' ],
|
||||
[ 'render', 'yellow' ],
|
||||
[ 'componentDidUpdate-currentState', 'yellow' ],
|
||||
[ 'componentDidUpdate-prevState', 'orange' ],
|
||||
[ 'setState-yellow', 'yellow' ],
|
||||
[ 'initial-callback', 'yellow' ],
|
||||
[ 'componentWillReceiveProps-start', 'yellow' ],
|
||||
['componentDidMount-end', 'orange'],
|
||||
['shouldComponentUpdate-currentState', 'orange'],
|
||||
['shouldComponentUpdate-nextState', 'yellow'],
|
||||
['componentWillUpdate-currentState', 'orange'],
|
||||
['componentWillUpdate-nextState', 'yellow'],
|
||||
['render', 'yellow'],
|
||||
['componentDidUpdate-currentState', 'yellow'],
|
||||
['componentDidUpdate-prevState', 'orange'],
|
||||
['setState-yellow', 'yellow'],
|
||||
['initial-callback', 'yellow'],
|
||||
['componentWillReceiveProps-start', 'yellow'],
|
||||
// setState({color:'green'}) only enqueues a pending state.
|
||||
[ 'componentWillReceiveProps-end', 'yellow' ],
|
||||
['componentWillReceiveProps-end', 'yellow'],
|
||||
// pending state queue is processed
|
||||
// before-setState-receiveProps never called, due to replaceState.
|
||||
[ 'before-setState-again-receiveProps', undefined ],
|
||||
[ 'after-setState-receiveProps', 'green' ],
|
||||
[ 'shouldComponentUpdate-currentState', 'yellow' ],
|
||||
[ 'shouldComponentUpdate-nextState', 'green' ],
|
||||
[ 'componentWillUpdate-currentState', 'yellow' ],
|
||||
[ 'componentWillUpdate-nextState', 'green' ],
|
||||
[ 'render', 'green' ],
|
||||
[ 'componentDidUpdate-currentState', 'green' ],
|
||||
[ 'componentDidUpdate-prevState', 'yellow' ],
|
||||
[ 'setState-receiveProps', 'green' ],
|
||||
[ 'setProps', 'green' ],
|
||||
['before-setState-again-receiveProps', undefined],
|
||||
['after-setState-receiveProps', 'green'],
|
||||
['shouldComponentUpdate-currentState', 'yellow'],
|
||||
['shouldComponentUpdate-nextState', 'green'],
|
||||
['componentWillUpdate-currentState', 'yellow'],
|
||||
['componentWillUpdate-nextState', 'green'],
|
||||
['render', 'green'],
|
||||
['componentDidUpdate-currentState', 'green'],
|
||||
['componentDidUpdate-prevState', 'yellow'],
|
||||
['setState-receiveProps', 'green'],
|
||||
['setProps', 'green'],
|
||||
// setFavoriteColor('blue')
|
||||
[ 'shouldComponentUpdate-currentState', 'green' ],
|
||||
[ 'shouldComponentUpdate-nextState', 'blue' ],
|
||||
[ 'componentWillUpdate-currentState', 'green' ],
|
||||
[ 'componentWillUpdate-nextState', 'blue' ],
|
||||
[ 'render', 'blue' ],
|
||||
[ 'componentDidUpdate-currentState', 'blue' ],
|
||||
[ 'componentDidUpdate-prevState', 'green' ],
|
||||
[ 'setFavoriteColor', 'blue' ],
|
||||
['shouldComponentUpdate-currentState', 'green'],
|
||||
['shouldComponentUpdate-nextState', 'blue'],
|
||||
['componentWillUpdate-currentState', 'green'],
|
||||
['componentWillUpdate-nextState', 'blue'],
|
||||
['render', 'blue'],
|
||||
['componentDidUpdate-currentState', 'blue'],
|
||||
['componentDidUpdate-prevState', 'green'],
|
||||
['setFavoriteColor', 'blue'],
|
||||
// forceUpdate()
|
||||
[ 'componentWillUpdate-currentState', 'blue' ],
|
||||
[ 'componentWillUpdate-nextState', 'blue' ],
|
||||
[ 'render', 'blue' ],
|
||||
[ 'componentDidUpdate-currentState', 'blue' ],
|
||||
[ 'componentDidUpdate-prevState', 'blue' ],
|
||||
[ 'forceUpdate', 'blue' ],
|
||||
['componentWillUpdate-currentState', 'blue'],
|
||||
['componentWillUpdate-nextState', 'blue'],
|
||||
['render', 'blue'],
|
||||
['componentDidUpdate-currentState', 'blue'],
|
||||
['componentDidUpdate-prevState', 'blue'],
|
||||
['forceUpdate', 'blue'],
|
||||
// unmountComponent()
|
||||
// state is available within `componentWillUnmount()`
|
||||
[ 'componentWillUnmount', 'blue' ]
|
||||
['componentWillUnmount', 'blue']
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('ReactJSXElementValidator', function() {
|
||||
render() {
|
||||
return (
|
||||
<InnerComponent
|
||||
childSet={[ <Component />, <Component /> ]}
|
||||
childSet={[<Component />, <Component />]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ describe('ReactJSXElementValidator', function() {
|
||||
it('does not warns for arrays of elements with keys', function() {
|
||||
spyOn(console, 'warn');
|
||||
|
||||
<Component>{[ <Component key="#1" />, <Component key="#2" /> ]}</Component>;
|
||||
<Component>{[<Component key="#1" />, <Component key="#2" />]}</Component>;
|
||||
|
||||
expect(console.warn.argsForCall.length).toBe(0);
|
||||
});
|
||||
|
||||
@@ -434,7 +434,7 @@ describe('ReactChildren', function() {
|
||||
it('should warn if a fragment is accessed', function() {
|
||||
spyOn(console, 'warn');
|
||||
var child = React.createElement('span');
|
||||
var frag = ReactChildren.map([ child, child ], function(c) {
|
||||
var frag = ReactChildren.map([child, child], function(c) {
|
||||
return c;
|
||||
});
|
||||
for (var key in frag) {
|
||||
@@ -444,7 +444,7 @@ describe('ReactChildren', function() {
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toContain('is an opaque type');
|
||||
|
||||
var frag2 = ReactChildren.map([ child, child ], function(c) {
|
||||
var frag2 = ReactChildren.map([child, child], function(c) {
|
||||
return c;
|
||||
});
|
||||
for (var key in frag2) {
|
||||
|
||||
Reference in New Issue
Block a user