mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Enable react/jsx-space-before-closing rule (#9077)
We mostly do this but not 100%; I fixed the stragglers here with `./node_modules/.bin/eslint --fix src` and enabled the lint rule.
This commit is contained in:
@@ -43,6 +43,7 @@ module.exports = {
|
||||
'react/jsx-no-undef': ERROR,
|
||||
// We don't care to do this
|
||||
'react/jsx-sort-prop-types': OFF,
|
||||
'react/jsx-space-before-closing': ERROR,
|
||||
'react/jsx-uses-react': ERROR,
|
||||
'react/no-is-mounted': OFF,
|
||||
// This isn't useful in our test code
|
||||
|
||||
@@ -283,8 +283,8 @@ describe('ReactCSSTransitionGroup', () => {
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Component/>, container);
|
||||
ReactDOM.render(<Component><span key="yolo" id="yolo"/></Component>, container);
|
||||
ReactDOM.render(<Component />, container);
|
||||
ReactDOM.render(<Component><span key="yolo" id="yolo" /></Component>, container);
|
||||
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
|
||||
@@ -322,7 +322,7 @@ describe('ReactCSSTransitionGroup', () => {
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Component/>, container);
|
||||
ReactDOM.render(<Component />, container);
|
||||
|
||||
// Testing that no exception is thrown here, as the timeout has been cleared.
|
||||
jest.runAllTimers();
|
||||
|
||||
@@ -297,7 +297,7 @@ describe('ReactTransitionGroup', () => {
|
||||
|
||||
class Component extends React.Component {
|
||||
render() {
|
||||
var children = [<div key="1"/>, <div key="1" />];
|
||||
var children = [<div key="1" />, <div key="1" />];
|
||||
return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ describe('ReactContextValidator', () => {
|
||||
}
|
||||
}
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA />);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
|
||||
'Warning: ComponentA.childContextTypes is specified but there is no ' +
|
||||
@@ -320,9 +320,9 @@ describe('ReactContextValidator', () => {
|
||||
);
|
||||
|
||||
// Warnings should be deduped by component type
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA />);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentB/>);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentB />);
|
||||
expectDev(console.error.calls.count()).toBe(2);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
|
||||
'Warning: ComponentB.childContextTypes is specified but there is no ' +
|
||||
@@ -371,7 +371,7 @@ describe('ReactContextValidator', () => {
|
||||
},
|
||||
});
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<ParentContextProvider/>);
|
||||
ReactTestUtils.renderIntoDocument(<ParentContextProvider />);
|
||||
expect(childContext.bar).toBeUndefined();
|
||||
expect(childContext.foo).toBe('FOO');
|
||||
});
|
||||
|
||||
@@ -553,7 +553,7 @@ describe('comparing jsx vs .createFactory() vs .createElement()', () => {
|
||||
);
|
||||
},
|
||||
});
|
||||
instance = ReactTestUtils.renderIntoDocument(<Parent/>);
|
||||
instance = ReactTestUtils.renderIntoDocument(<Parent />);
|
||||
});
|
||||
|
||||
it('should scry children but cannot', () => {
|
||||
|
||||
@@ -56,9 +56,9 @@ describe('ReactComponent', () => {
|
||||
expect(() => {
|
||||
ReactTestUtils.renderIntoDocument(
|
||||
<Wrapper>
|
||||
<span key={0}/>
|
||||
<span key={1}/>
|
||||
<span key={2}/>
|
||||
<span key={0} />
|
||||
<span key={1} />
|
||||
<span key={2} />
|
||||
</Wrapper>
|
||||
);
|
||||
}).toThrowError(/Cannot assign to read only property.*/);
|
||||
@@ -81,9 +81,9 @@ describe('ReactComponent', () => {
|
||||
expect(() => {
|
||||
ReactTestUtils.renderIntoDocument(
|
||||
<Wrapper>
|
||||
<span key={0}/>
|
||||
<span key={1}/>
|
||||
<span key={2}/>
|
||||
<span key={0} />
|
||||
<span key={1} />
|
||||
<span key={2} />
|
||||
</Wrapper>
|
||||
);
|
||||
}).toThrowError(/Cannot assign to read only property.*/);
|
||||
@@ -247,10 +247,10 @@ describe('ReactComponent', () => {
|
||||
<div>
|
||||
<Inner id={1} ref={(c) => {
|
||||
log.push(`ref 1 got ${c ? `instance ${c.props.id}` : 'null'}`);
|
||||
}}/>
|
||||
}} />
|
||||
<Inner id={2} ref={(c) => {
|
||||
log.push(`ref 2 got ${c ? `instance ${c.props.id}` : 'null'}`);
|
||||
}}/>
|
||||
}} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ describe('ReactComponentLifeCycle', () => {
|
||||
},
|
||||
render: function() {
|
||||
expect(this.isMounted()).toBeFalsy();
|
||||
return <div/>;
|
||||
return <div />;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -292,7 +292,7 @@ describe('ReactComponentLifeCycle', () => {
|
||||
it('isMounted should return false when unmounted', () => {
|
||||
var Component = React.createClass({
|
||||
render: function() {
|
||||
return <div/>;
|
||||
return <div />;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -319,7 +319,7 @@ describe('ReactComponentLifeCycle', () => {
|
||||
if (this.state.isMounted) {
|
||||
expect(ReactDOM.findDOMNode(this).tagName).toBe('DIV');
|
||||
}
|
||||
return <div/>;
|
||||
return <div />;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -138,19 +138,19 @@ describe('ReactCompositeComponent', () => {
|
||||
it('should not cache old DOM nodes when switching constructors', () => {
|
||||
var container = document.createElement('div');
|
||||
var instance = ReactDOM.render(
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={false}/>,
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={false} />,
|
||||
container
|
||||
);
|
||||
ReactDOM.render( // Warm any cache
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={true}/>,
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={true} />,
|
||||
container
|
||||
);
|
||||
ReactDOM.render( // Clear out the anchor
|
||||
<ChildUpdates renderAnchor={false} anchorClassOn={true}/>,
|
||||
<ChildUpdates renderAnchor={false} anchorClassOn={true} />,
|
||||
container
|
||||
);
|
||||
ReactDOM.render( // rerender
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={false}/>,
|
||||
<ChildUpdates renderAnchor={true} anchorClassOn={false} />,
|
||||
container
|
||||
);
|
||||
expect(instance.getAnchor().className).toBe('');
|
||||
|
||||
@@ -178,12 +178,12 @@ describe('ReactMultiChild', () => {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Parent>{[<div key="1"/>]}</Parent>,
|
||||
<Parent>{[<div key="1" />]}</Parent>,
|
||||
container
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<Parent>{[<div key="1"/>, <div key="1"/>]}</Parent>,
|
||||
<Parent>{[<div key="1" />, <div key="1" />]}</Parent>,
|
||||
container
|
||||
);
|
||||
|
||||
@@ -241,12 +241,12 @@ describe('ReactMultiChild', () => {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Parent>{createIterable([<div key="1"/>])}</Parent>,
|
||||
<Parent>{createIterable([<div key="1" />])}</Parent>,
|
||||
container
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<Parent>{createIterable([<div key="1"/>, <div key="1"/>])}</Parent>,
|
||||
<Parent>{createIterable([<div key="1" />, <div key="1" />])}</Parent>,
|
||||
container
|
||||
);
|
||||
|
||||
|
||||
@@ -107,20 +107,20 @@ describe('refs-destruction', () => {
|
||||
class AppModal extends React.Component {
|
||||
render() {
|
||||
return (<Modal>
|
||||
<a ref="ref"/>
|
||||
<a ref="ref" />
|
||||
</Modal>);
|
||||
}
|
||||
}
|
||||
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
return this.props.hidden ? null : <AppModal onClose={this.close}/>;
|
||||
return this.props.hidden ? null : <AppModal onClose={this.close} />;
|
||||
}
|
||||
}
|
||||
|
||||
var container = document.createElement('div');
|
||||
ReactDOM.render(<App />, container);
|
||||
ReactDOM.render(<App hidden={true}/>, container);
|
||||
ReactDOM.render(<App hidden={true} />, container);
|
||||
jest.runAllTimers();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestRefsComponent extends React.Component {
|
||||
Reset Me By Clicking This.
|
||||
</div>
|
||||
<GeneralContainerComponent ref="myContainer">
|
||||
<ClickCounter ref="myCounter" initialCount={1}/>
|
||||
<ClickCounter ref="myCounter" initialCount={1} />
|
||||
</GeneralContainerComponent>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -112,7 +112,7 @@ describe('CSSPropertyOperations', () => {
|
||||
static displayName = 'Comp';
|
||||
|
||||
render() {
|
||||
return <div style={{ 'background-color': 'crimson' }}/>;
|
||||
return <div style={{ 'background-color': 'crimson' }} />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ describe('CSSPropertyOperations', () => {
|
||||
static displayName = 'Comp';
|
||||
|
||||
render() {
|
||||
return <div style={{ fontSize: NaN }}/>;
|
||||
return <div style={{ fontSize: NaN }} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ describe('ReactDOM', () => {
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<h1>Auto-focus Test</h1>
|
||||
<input autoFocus={true}/>
|
||||
<input autoFocus={true} />
|
||||
<p>The above input should be focused after mount.</p>
|
||||
</div>,
|
||||
container,
|
||||
|
||||
@@ -360,8 +360,8 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should properly update custom attributes on custom elements', () => {
|
||||
var container = document.createElement('div');
|
||||
ReactDOM.render(<some-custom-element foo="bar"/>, container);
|
||||
ReactDOM.render(<some-custom-element bar="buzz"/>, container);
|
||||
ReactDOM.render(<some-custom-element foo="bar" />, container);
|
||||
ReactDOM.render(<some-custom-element bar="buzz" />, container);
|
||||
var node = container.firstChild;
|
||||
expect(node.hasAttribute('foo')).toBe(false);
|
||||
expect(node.getAttribute('bar')).toBe('buzz');
|
||||
@@ -637,7 +637,7 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should ignore attribute whitelist for elements with the "is: attribute', () => {
|
||||
var container = document.createElement('div');
|
||||
ReactDOM.render(<button is="test" cowabunga="chevynova"/>, container);
|
||||
ReactDOM.render(<button is="test" cowabunga="chevynova" />, container);
|
||||
expect(container.firstChild.hasAttribute('cowabunga')).toBe(true);
|
||||
});
|
||||
|
||||
@@ -838,7 +838,7 @@ describe('ReactDOMComponent', () => {
|
||||
}
|
||||
}
|
||||
|
||||
var returnedValue = ReactDOMServer.renderToString(<Container/>);
|
||||
var returnedValue = ReactDOMServer.renderToString(<Container />);
|
||||
expect(returnedValue).not.toContain('</BR>');
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
expectDev(console.error.calls.argsFor(0)[0]).toContain(
|
||||
@@ -1060,7 +1060,7 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should track input values', () => {
|
||||
var container = document.createElement('div');
|
||||
var inst = ReactDOM.render(<input type="text" defaultValue="foo"/>, container);
|
||||
var inst = ReactDOM.render(<input type="text" defaultValue="foo" />, container);
|
||||
|
||||
var tracker = inputValueTracking._getTrackerFromNode(inst);
|
||||
|
||||
@@ -1069,7 +1069,7 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should track textarea values', () => {
|
||||
var container = document.createElement('div');
|
||||
var inst = ReactDOM.render(<textarea defaultValue="foo"/>, container);
|
||||
var inst = ReactDOM.render(<textarea defaultValue="foo" />, container);
|
||||
|
||||
var tracker = inputValueTracking._getTrackerFromNode(inst);
|
||||
|
||||
@@ -1211,7 +1211,7 @@ describe('ReactDOMComponent', () => {
|
||||
}
|
||||
|
||||
expect(function() {
|
||||
ReactDOM.render(<Animal/>, container);
|
||||
ReactDOM.render(<Animal />, container);
|
||||
}).toThrowError(
|
||||
'The `style` prop expects a mapping from style properties to values, ' +
|
||||
'not a string. For example, style={{marginRight: spacing + \'em\'}} ' +
|
||||
@@ -1242,7 +1242,7 @@ describe('ReactDOMComponent', () => {
|
||||
if (!ReactDOMFeatureFlags.useFiber) {
|
||||
it('should clean up input value tracking', () => {
|
||||
var container = document.createElement('div');
|
||||
var node = ReactDOM.render(<input type="text" defaultValue="foo"/>, container);
|
||||
var node = ReactDOM.render(<input type="text" defaultValue="foo" />, container);
|
||||
var tracker = inputValueTracking._getTrackerFromNode(node);
|
||||
|
||||
spyOn(tracker, 'stopTracking');
|
||||
@@ -1254,7 +1254,7 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should clean up input textarea tracking', () => {
|
||||
var container = document.createElement('div');
|
||||
var node = ReactDOM.render(<textarea defaultValue="foo"/>, container);
|
||||
var node = ReactDOM.render(<textarea defaultValue="foo" />, container);
|
||||
var tracker = inputValueTracking._getTrackerFromNode(node);
|
||||
|
||||
spyOn(tracker, 'stopTracking');
|
||||
@@ -1303,7 +1303,7 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('should not warn when server-side rendering `onScroll`', () => {
|
||||
spyOn(console, 'error');
|
||||
ReactDOMServer.renderToString(<div onScroll={() => {}}/>);
|
||||
ReactDOMServer.renderToString(<div onScroll={() => {}} />);
|
||||
expectDev(console.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1614,8 +1614,8 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('gives source code refs for unknown prop warning', () => {
|
||||
spyOn(console, 'error');
|
||||
ReactTestUtils.renderIntoDocument(<div class="paladin"/>);
|
||||
ReactTestUtils.renderIntoDocument(<input type="text" onclick="1"/>);
|
||||
ReactTestUtils.renderIntoDocument(<div class="paladin" />);
|
||||
ReactTestUtils.renderIntoDocument(<input type="text" onclick="1" />);
|
||||
expectDev(console.error.calls.count()).toBe(2);
|
||||
expect(
|
||||
normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])
|
||||
@@ -1632,8 +1632,8 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
it('gives source code refs for unknown prop warning (ssr)', () => {
|
||||
spyOn(console, 'error');
|
||||
ReactDOMServer.renderToString(<div class="paladin"/>);
|
||||
ReactDOMServer.renderToString(<input type="text" onclick="1"/>);
|
||||
ReactDOMServer.renderToString(<div class="paladin" />);
|
||||
ReactDOMServer.renderToString(<input type="text" onclick="1" />);
|
||||
expectDev(console.error.calls.count()).toBe(2);
|
||||
expect(
|
||||
normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])
|
||||
@@ -1669,11 +1669,11 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
ReactTestUtils.renderIntoDocument(
|
||||
<div className="foo1">
|
||||
<div class="foo2"/>
|
||||
<div onClick="foo3"/>
|
||||
<div onclick="foo4"/>
|
||||
<div className="foo5"/>
|
||||
<div className="foo6"/>
|
||||
<div class="foo2" />
|
||||
<div onClick="foo3" />
|
||||
<div onclick="foo4" />
|
||||
<div className="foo5" />
|
||||
<div className="foo6" />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1697,11 +1697,11 @@ describe('ReactDOMComponent', () => {
|
||||
|
||||
ReactDOMServer.renderToString(
|
||||
<div className="foo1">
|
||||
<div class="foo2"/>
|
||||
<div onClick="foo3"/>
|
||||
<div onclick="foo4"/>
|
||||
<div className="foo5"/>
|
||||
<div className="foo6"/>
|
||||
<div class="foo2" />
|
||||
<div onClick="foo3" />
|
||||
<div onclick="foo4" />
|
||||
<div className="foo5" />
|
||||
<div className="foo6" />
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('ReactDOMTextComponent', () => {
|
||||
|
||||
it('can reconcile text arbitrarily split into multiple nodes on some substitutions only', () => {
|
||||
var el = document.createElement('div');
|
||||
var inst = ReactDOM.render(<div><span />{'bar'}<span />{'foobarbaz'}{'foo'}{'barfoo'}<span/></div>, el);
|
||||
var inst = ReactDOM.render(<div><span />{'bar'}<span />{'foobarbaz'}{'foo'}{'barfoo'}<span /></div>, el);
|
||||
|
||||
var container = ReactDOM.findDOMNode(inst);
|
||||
let childNodes = filterOutComments(ReactDOM.findDOMNode(inst).childNodes);
|
||||
@@ -143,7 +143,7 @@ describe('ReactDOMTextComponent', () => {
|
||||
secondTextNode.textContent = 'bar';
|
||||
container.insertBefore(document.createTextNode('foo'), childNodes[5].nextSibling);
|
||||
|
||||
inst = ReactDOM.render(<div><span />{'baz'}<span />{'barbazqux'}{'bar'}{'bazbar'}<span/></div>, el);
|
||||
inst = ReactDOM.render(<div><span />{'baz'}<span />{'barbazqux'}{'bar'}{'bazbar'}<span /></div>, el);
|
||||
container = ReactDOM.findDOMNode(inst);
|
||||
expect(container.textContent).toBe('bazbarbazquxbarbazbar');
|
||||
});
|
||||
|
||||
@@ -542,9 +542,9 @@ describe('ReactDOMServer', () => {
|
||||
expect(() => {
|
||||
ReactDOMServer.renderToStaticMarkup(
|
||||
<Wrapper>
|
||||
<span key={0}/>
|
||||
<span key={1}/>
|
||||
<span key={2}/>
|
||||
<span key={0} />
|
||||
<span key={1} />
|
||||
<span key={2} />
|
||||
</Wrapper>
|
||||
);
|
||||
}).toThrowError(/Cannot assign to read only property.*/);
|
||||
|
||||
@@ -91,11 +91,11 @@ describe('findDOMNode', () => {
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div/>;
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
expect(() => ReactTestUtils.renderIntoDocument(<Bar/>)).not.toThrow();
|
||||
expect(() => ReactTestUtils.renderIntoDocument(<Bar />)).not.toThrow();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('ChangeEventPlugin', () => {
|
||||
expect(e.type).toBe('change');
|
||||
}
|
||||
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="checkbox" onChange={cb}/>);
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="checkbox" onChange={cb} />);
|
||||
|
||||
setUntrackedValue(input, true);
|
||||
ReactTestUtils.SimulateNative.click(input);
|
||||
@@ -58,7 +58,7 @@ describe('ChangeEventPlugin', () => {
|
||||
|
||||
it('should catch setting the value programmatically', () => {
|
||||
var input = ReactTestUtils.renderIntoDocument(
|
||||
<input type="text" defaultValue="foo"/>
|
||||
<input type="text" defaultValue="foo" />
|
||||
);
|
||||
|
||||
input.value = 'bar';
|
||||
@@ -74,7 +74,7 @@ describe('ChangeEventPlugin', () => {
|
||||
}
|
||||
|
||||
var input = ReactTestUtils.renderIntoDocument(
|
||||
<input type="text" onChange={cb} defaultValue="foo"/>
|
||||
<input type="text" onChange={cb} defaultValue="foo" />
|
||||
);
|
||||
|
||||
input.value = 'bar';
|
||||
@@ -124,7 +124,7 @@ describe('ChangeEventPlugin', () => {
|
||||
called += 1;
|
||||
}
|
||||
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="radio" onChange={cb}/>);
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="radio" onChange={cb} />);
|
||||
setUntrackedValue(input, true);
|
||||
ReactTestUtils.SimulateNative.click(input);
|
||||
ReactTestUtils.SimulateNative.click(input);
|
||||
@@ -141,9 +141,9 @@ describe('ChangeEventPlugin', () => {
|
||||
}
|
||||
|
||||
[
|
||||
<input type="text" onChange={cb}/>,
|
||||
<input type="number" onChange={cb}/>,
|
||||
<input type="range" onChange={cb}/>,
|
||||
<input type="text" onChange={cb} />,
|
||||
<input type="number" onChange={cb} />,
|
||||
<input type="range" onChange={cb} />,
|
||||
].forEach(function(element) {
|
||||
called = 0;
|
||||
input = ReactTestUtils.renderIntoDocument(element);
|
||||
@@ -181,7 +181,7 @@ describe('ChangeEventPlugin', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="range" onChange={cb}/>);
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="range" onChange={cb} />);
|
||||
setUntrackedValue(input, 'bar');
|
||||
|
||||
ReactTestUtils.SimulateNative.input(input);
|
||||
@@ -201,7 +201,7 @@ describe('ChangeEventPlugin', () => {
|
||||
expect(e.type).toBe('change');
|
||||
}
|
||||
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="range" onChange={cb}/>);
|
||||
var input = ReactTestUtils.renderIntoDocument(<input type="range" onChange={cb} />);
|
||||
setUntrackedValue(input, '40');
|
||||
ReactTestUtils.SimulateNative.input(input);
|
||||
ReactTestUtils.SimulateNative.change(input);
|
||||
|
||||
@@ -407,7 +407,7 @@ describe('ReactDOMInput', () => {
|
||||
ReactDOM.render(<input value="a" />, container);
|
||||
expect(nodeValueSetter.mock.calls.length).toBe(0);
|
||||
|
||||
ReactDOM.render(<input value="b"/>, container);
|
||||
ReactDOM.render(<input value="b" />, container);
|
||||
expect(nodeValueSetter.mock.calls.length).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -429,14 +429,14 @@ describe('ReactDOMSelect', () => {
|
||||
it('should warn if value is null', () => {
|
||||
spyOn(console, 'error');
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
|
||||
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test" /></select>);
|
||||
expectDev(console.error.calls.argsFor(0)[0]).toContain(
|
||||
'`value` prop on `select` should not be null. ' +
|
||||
'Consider using the empty string to clear the component or `undefined` ' +
|
||||
'for uncontrolled components.'
|
||||
);
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
|
||||
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test" /></select>);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -965,12 +965,12 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
throw Error('componentWillMount error');
|
||||
}
|
||||
render() {
|
||||
return <div/>;
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent/></span></div>);
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent /></span></div>);
|
||||
ReactNoop.flushDeferredPri();
|
||||
} catch (error) {}
|
||||
|
||||
@@ -999,12 +999,12 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
throw Error('componentDidMount error');
|
||||
}
|
||||
render() {
|
||||
return <div/>;
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent/></span></div>);
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent /></span></div>);
|
||||
ReactNoop.flushDeferredPri();
|
||||
} catch (error) {}
|
||||
|
||||
@@ -1045,7 +1045,7 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
);
|
||||
|
||||
try {
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent/></span></div>);
|
||||
ReactNoop.render(<div><span><ErrorThrowingComponent /></span></div>);
|
||||
ReactNoop.flushDeferredPri();
|
||||
} catch (error) {}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
|
||||
class ParentComponent extends React.Component {
|
||||
render() {
|
||||
return <ErrorBoundaryComponent/>;
|
||||
return <ErrorBoundaryComponent />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
this.setState({}); // Render again
|
||||
}
|
||||
render() {
|
||||
return <ErrorThrowingComponent/>;
|
||||
return <ErrorThrowingComponent />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,12 +1085,12 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
}
|
||||
render() {
|
||||
renderAttempts++;
|
||||
return <div/>;
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ReactNoop.render(<ParentComponent/>);
|
||||
ReactNoop.render(<ParentComponent />);
|
||||
ReactNoop.flush();
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ describe('ReactIncrementalSideEffects', () => {
|
||||
|
||||
it('can update a completed tree before it has a chance to commit', () => {
|
||||
function Foo(props) {
|
||||
return <span prop={props.step}/>;
|
||||
return <span prop={props.step} />;
|
||||
}
|
||||
ReactNoop.render(<Foo step={1} />);
|
||||
// This should be just enough to complete the tree without committing it
|
||||
|
||||
Reference in New Issue
Block a user