Skip to content

Commit b60e8c2

Browse files
committed
Merge pull request facebook#5829 from zpao/style-followup
Fixup style for long lines
2 parents 171305f + 26f53de commit b60e8c2

File tree

6 files changed

+59
-38
lines changed

6 files changed

+59
-38
lines changed

src/renderers/dom/client/wrappers/ReactDOMInput.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,32 @@ var ReactDOMInput = {
106106
);
107107
didWarnCheckedLink = true;
108108
}
109-
if (props.checked !== undefined && props.defaultChecked !== undefined &&
110-
!didWarnCheckedDefaultChecked) {
109+
if (
110+
props.checked !== undefined &&
111+
props.defaultChecked !== undefined &&
112+
!didWarnCheckedDefaultChecked
113+
) {
111114
warning(
112115
false,
113-
'Input elements must be either controlled or uncontrolled (specify either the ' +
114-
'checked prop, or the defaultChecked prop, but not both). Decide between using a ' +
115-
'controlled or uncontrolled input and remove one of these props. More info: ' +
116+
'Input elements must be either controlled or uncontrolled ' +
117+
'(specify either the checked prop, or the defaultChecked prop, but not ' +
118+
'both). Decide between using a controlled or uncontrolled input ' +
119+
'element and remove one of these props. More info: ' +
116120
'https://fb.me/react-controlled-components'
117121
);
118122
didWarnCheckedDefaultChecked = true;
119123
}
120-
if (props.value !== undefined && props.defaultValue !== undefined &&
121-
!didWarnValueDefaultValue) {
124+
if (
125+
props.value !== undefined &&
126+
props.defaultValue !== undefined &&
127+
!didWarnValueDefaultValue
128+
) {
122129
warning(
123130
false,
124-
'Input elements must be either controlled or uncontrolled (specify either the value ' +
125-
'prop, or the defaultValue prop, but not both). Decide between using a controlled ' +
126-
'or uncontrolled input and remove one of these props. More info: ' +
131+
'Input elements must be either controlled or uncontrolled ' +
132+
'(specify either the value prop, or the defaultValue prop, but not ' +
133+
'both). Decide between using a controlled or uncontrolled input ' +
134+
'element and remove one of these props. More info: ' +
127135
'https://fb.me/react-controlled-components'
128136
);
129137
didWarnValueDefaultValue = true;

src/renderers/dom/client/wrappers/ReactDOMSelect.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,17 @@ var ReactDOMSelect = {
180180
wasMultiple: Boolean(props.multiple),
181181
};
182182

183-
if (props.value !== undefined && props.defaultValue !== undefined &&
184-
!didWarnValueDefaultValue) {
183+
if (
184+
props.value !== undefined &&
185+
props.defaultValue !== undefined &&
186+
!didWarnValueDefaultValue
187+
) {
185188
warning(
186189
false,
187-
'Select elements must be either controlled or uncontrolled (specify either the ' +
188-
'value prop, or the defaultValue prop, but not both). Decide between using a ' +
189-
'controlled or uncontrolled select element and remove one of these props. More info: ' +
190+
'Select elements must be either controlled or uncontrolled ' +
191+
'(specify either the value prop, or the defaultValue prop, but not ' +
192+
'both). Decide between using a controlled or uncontrolled select ' +
193+
'element and remove one of these props. More info: ' +
190194
'https://fb.me/react-controlled-components'
191195
);
192196
didWarnValueDefaultValue = true;

src/renderers/dom/client/wrappers/ReactDOMTextarea.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,17 @@ var ReactDOMTextarea = {
9292
);
9393
didWarnValueLink = true;
9494
}
95-
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
95+
if (
96+
props.value !== undefined &&
97+
props.defaultValue !== undefined &&
98+
!didWarnValDefaultVal
99+
) {
96100
warning(
97101
false,
98-
'Textarea elements must be either controlled or uncontrolled (specify either the value ' +
99-
'prop, or the defaultValue prop, but not both). Decide between using a controlled or ' +
100-
'uncontrolled input and remove one of these props. More info: ' +
102+
'Textarea elements must be either controlled or uncontrolled ' +
103+
'(specify either the value prop, or the defaultValue prop, but not ' +
104+
'both). Decide between using a controlled or uncontrolled textarea ' +
105+
'and remove one of these props. More info: ' +
101106
'https://fb.me/react-controlled-components'
102107
);
103108
didWarnValDefaultVal = true;

src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ describe('ReactDOMInput', function() {
403403
expect(() => ReactDOM.render(instance, node)).toThrow();
404404
});
405405

406-
it('should throw warning message if value is null', function() {
406+
it('should warn if value is null', function() {
407407
ReactTestUtils.renderIntoDocument(<input type="text" value={null} />);
408408
expect(console.error.argsForCall[0][0]).toContain(
409409
'`value` prop on `input` should not be null. ' +
@@ -415,14 +415,15 @@ describe('ReactDOMInput', function() {
415415
expect(console.error.argsForCall.length).toBe(1);
416416
});
417417

418-
it('should throw warning message if checked and defaultChecked props are specified', function() {
418+
it('should warn if checked and defaultChecked props are specified', function() {
419419
ReactTestUtils.renderIntoDocument(
420420
<input type="radio" checked={true} defaultChecked={true} readOnly={true} />
421421
);
422422
expect(console.error.argsForCall[0][0]).toContain(
423-
'Input elements must be either controlled or uncontrolled (specify either the ' +
424-
'checked prop, or the defaultChecked prop, but not both). Decide between using a ' +
425-
'controlled or uncontrolled input and remove one of these props. More info: ' +
423+
'Input elements must be either controlled or uncontrolled ' +
424+
'(specify either the checked prop, or the defaultChecked prop, but not ' +
425+
'both). Decide between using a controlled or uncontrolled input ' +
426+
'element and remove one of these props. More info: ' +
426427
'https://fb.me/react-controlled-components'
427428
);
428429

@@ -432,14 +433,15 @@ describe('ReactDOMInput', function() {
432433
expect(console.error.argsForCall.length).toBe(1);
433434
});
434435

435-
it('should throw warning message if value and defaultValue props are specified', function() {
436+
it('should warn if value and defaultValue props are specified', function() {
436437
ReactTestUtils.renderIntoDocument(
437438
<input type="text" value="foo" defaultValue="bar" readOnly={true} />
438439
);
439440
expect(console.error.argsForCall[0][0]).toContain(
440-
'Input elements must be either controlled or uncontrolled (specify either the value ' +
441-
'prop, or the defaultValue prop, but not both). Decide between using a controlled or ' +
442-
'uncontrolled input and remove one of these props. More info: ' +
441+
'Input elements must be either controlled or uncontrolled ' +
442+
'(specify either the value prop, or the defaultValue prop, but not ' +
443+
'both). Decide between using a controlled or uncontrolled input ' +
444+
'element and remove one of these props. More info: ' +
443445
'https://fb.me/react-controlled-components'
444446
);
445447

src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ describe('ReactDOMSelect', function() {
462462
expect(node.options[2].selected).toBe(false); // gorilla
463463
});
464464

465-
it('should throw warning message if value is null', function() {
465+
it('should warn if value is null', function() {
466466
spyOn(console, 'error');
467467

468468
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
@@ -491,7 +491,7 @@ describe('ReactDOMSelect', function() {
491491
expect(node.value).toBe('giraffe');
492492
});
493493

494-
it('should throw warning message if value and defaultValue props are specified', function() {
494+
it('should warn if value and defaultValue props are specified', function() {
495495
spyOn(console, 'error');
496496
ReactTestUtils.renderIntoDocument(
497497
<select value="giraffe" defaultValue="giraffe" readOnly={true}>
@@ -501,9 +501,10 @@ describe('ReactDOMSelect', function() {
501501
</select>
502502
);
503503
expect(console.error.argsForCall[0][0]).toContain(
504-
'Select elements must be either controlled or uncontrolled (specify either the ' +
505-
'value prop, or the defaultValue prop, but not both). Decide between using a ' +
506-
'controlled or uncontrolled select element and remove one of these props. More info: ' +
504+
'Select elements must be either controlled or uncontrolled ' +
505+
'(specify either the value prop, or the defaultValue prop, but not ' +
506+
'both). Decide between using a controlled or uncontrolled select ' +
507+
'element and remove one of these props. More info: ' +
507508
'https://fb.me/react-controlled-components'
508509
);
509510

src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ describe('ReactDOMTextarea', function() {
265265
ReactDOM.unmountComponentAtNode(container);
266266
});
267267

268-
it('should throw warning message if value is null', function() {
268+
it('should warn if value is null', function() {
269269
spyOn(console, 'error');
270270

271271
ReactTestUtils.renderIntoDocument(<textarea value={null} />);
@@ -279,15 +279,16 @@ describe('ReactDOMTextarea', function() {
279279
expect(console.error.argsForCall.length).toBe(1);
280280
});
281281

282-
it('should throw warning message if value and defaultValue are specified', function() {
282+
it('should warn if value and defaultValue are specified', function() {
283283
spyOn(console, 'error');
284284
ReactTestUtils.renderIntoDocument(
285285
<textarea value="foo" defaultValue="bar" readOnly={true} />
286286
);
287287
expect(console.error.argsForCall[0][0]).toContain(
288-
'Textarea elements must be either controlled or uncontrolled (specify either the value ' +
289-
'prop, or the defaultValue prop, but not both). Decide between using a controlled or ' +
290-
'uncontrolled input and remove one of these props. More info: ' +
288+
'Textarea elements must be either controlled or uncontrolled ' +
289+
'(specify either the value prop, or the defaultValue prop, but not ' +
290+
'both). Decide between using a controlled or uncontrolled textarea ' +
291+
'and remove one of these props. More info: ' +
291292
'https://fb.me/react-controlled-components'
292293
);
293294

0 commit comments

Comments
 (0)