Fixup style for long lines
Paul O’Shannessy committed
Jan 11, 2016 at 17:20 UTC
26f53de4a6e203ed871db618ae7d2db8b5e17286
6 files changed
+59
-38
src/renderers/dom/client/wrappers/ReactDOMInput.js
+18
-10
@@ -106,24 +106,32 @@ var ReactDOMInput = {
106
);
107
didWarnCheckedLink = true;
108
}
109
- if (props.checked !== undefined && props.defaultChecked !== undefined &&
110
- !didWarnCheckedDefaultChecked) {
109
+ if (
110
+ props.checked !== undefined &&
111
+ props.defaultChecked !== undefined &&
112
+ !didWarnCheckedDefaultChecked
113
+ ) {
114
warning(
115
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: ' +
120
'https://fb.me/react-controlled-components'
121
);
122
didWarnCheckedDefaultChecked = true;
123
}
120
- if (props.value !== undefined && props.defaultValue !== undefined &&
121
- !didWarnValueDefaultValue) {
124
+ if (
125
+ props.value !== undefined &&
126
+ props.defaultValue !== undefined &&
127
+ !didWarnValueDefaultValue
128
+ ) {
129
warning(
130
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: ' +
135
'https://fb.me/react-controlled-components'
136
);
137
didWarnValueDefaultValue = true;
src/renderers/dom/client/wrappers/ReactDOMSelect.js
+9
-5
@@ -180,13 +180,17 @@ var ReactDOMSelect = {
180
wasMultiple: Boolean(props.multiple),
181
};
182
183
- if (props.value !== undefined && props.defaultValue !== undefined &&
184
- !didWarnValueDefaultValue) {
183
+ if (
184
+ props.value !== undefined &&
185
+ props.defaultValue !== undefined &&
186
+ !didWarnValueDefaultValue
187
+ ) {
188
warning(
189
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: ' +
194
'https://fb.me/react-controlled-components'
195
);
196
didWarnValueDefaultValue = true;
src/renderers/dom/client/wrappers/ReactDOMTextarea.js
+9
-4
@@ -92,12 +92,17 @@ var ReactDOMTextarea = {
92
);
93
didWarnValueLink = true;
94
}
95
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
95
+ if (
96
+ props.value !== undefined &&
97
+ props.defaultValue !== undefined &&
98
+ !didWarnValDefaultVal
99
+ ) {
100
warning(
101
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: ' +
106
'https://fb.me/react-controlled-components'
107
);
108
didWarnValDefaultVal = true;
src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
+11
-9
@@ -403,7 +403,7 @@ describe('ReactDOMInput', function() {
403
expect(() => ReactDOM.render(instance, node)).toThrow();
404
});
405
406
- it('should throw warning message if value is null', function() {
406
+ it('should warn if value is null', function() {
407
ReactTestUtils.renderIntoDocument(<input type="text" value={null} />);
408
expect(console.error.argsForCall[0][0]).toContain(
409
'`value` prop on `input` should not be null. ' +
@@ -415,14 +415,15 @@ describe('ReactDOMInput', function() {
415
expect(console.error.argsForCall.length).toBe(1);
416
});
417
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() {
419
ReactTestUtils.renderIntoDocument(
420
<input type="radio" checked={true} defaultChecked={true} readOnly={true} />
421
);
422
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: ' +
427
'https://fb.me/react-controlled-components'
428
);
429
@@ -432,14 +433,15 @@ describe('ReactDOMInput', function() {
433
expect(console.error.argsForCall.length).toBe(1);
434
});
435
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() {
437
ReactTestUtils.renderIntoDocument(
438
<input type="text" value="foo" defaultValue="bar" readOnly={true} />
439
);
440
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: ' +
445
'https://fb.me/react-controlled-components'
446
);
447
src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
+6
-5
@@ -462,7 +462,7 @@ describe('ReactDOMSelect', function() {
462
expect(node.options[2].selected).toBe(false); // gorilla
463
});
464
465
- it('should throw warning message if value is null', function() {
465
+ it('should warn if value is null', function() {
466
spyOn(console, 'error');
467
468
ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
@@ -491,7 +491,7 @@ describe('ReactDOMSelect', function() {
491
expect(node.value).toBe('giraffe');
492
});
493
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() {
495
spyOn(console, 'error');
496
ReactTestUtils.renderIntoDocument(
497
<select value="giraffe" defaultValue="giraffe" readOnly={true}>
@@ -501,9 +501,10 @@ describe('ReactDOMSelect', function() {
501
</select>
502
);
503
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: ' +
508
'https://fb.me/react-controlled-components'
509
);
510
src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
+6
-5
@@ -265,7 +265,7 @@ describe('ReactDOMTextarea', function() {
265
ReactDOM.unmountComponentAtNode(container);
266
});
267
268
- it('should throw warning message if value is null', function() {
268
+ it('should warn if value is null', function() {
269
spyOn(console, 'error');
270
271
ReactTestUtils.renderIntoDocument(<textarea value={null} />);
@@ -279,15 +279,16 @@ describe('ReactDOMTextarea', function() {
279
expect(console.error.argsForCall.length).toBe(1);
280
});
281
282
- it('should throw warning message if value and defaultValue are specified', function() {
282
+ it('should warn if value and defaultValue are specified', function() {
283
spyOn(console, 'error');
284
ReactTestUtils.renderIntoDocument(
285
<textarea value="foo" defaultValue="bar" readOnly={true} />
286
);
287
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: ' +
292
'https://fb.me/react-controlled-components'
293
);
294