Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup style for long lines #5829

Merged
merged 1 commit into from
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/renderers/dom/client/wrappers/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,32 @@ var ReactDOMInput = {
);
didWarnCheckedLink = true;
}
if (props.checked !== undefined && props.defaultChecked !== undefined &&
!didWarnCheckedDefaultChecked) {
if (
props.checked !== undefined &&
props.defaultChecked !== undefined &&
!didWarnCheckedDefaultChecked
) {
warning(
false,
'Input elements must be either controlled or uncontrolled (specify either the ' +
'checked prop, or the defaultChecked prop, but not both). Decide between using a ' +
'controlled or uncontrolled input and remove one of these props. More info: ' +
'Input elements must be either controlled or uncontrolled ' +
'(specify either the checked prop, or the defaultChecked prop, but not ' +
'both). Decide between using a controlled or uncontrolled input ' +
'element and remove one of these props. More info: ' +
'https://fb.me/react-controlled-components'
);
didWarnCheckedDefaultChecked = true;
}
if (props.value !== undefined && props.defaultValue !== undefined &&
!didWarnValueDefaultValue) {
if (
props.value !== undefined &&
props.defaultValue !== undefined &&
!didWarnValueDefaultValue
) {
warning(
false,
'Input elements must be either controlled or uncontrolled (specify either the value ' +
'prop, or the defaultValue prop, but not both). Decide between using a controlled ' +
'or uncontrolled input and remove one of these props. More info: ' +
'Input elements must be either controlled or uncontrolled ' +
'(specify either the value prop, or the defaultValue prop, but not ' +
'both). Decide between using a controlled or uncontrolled input ' +
'element and remove one of these props. More info: ' +
'https://fb.me/react-controlled-components'
);
didWarnValueDefaultValue = true;
Expand Down
14 changes: 9 additions & 5 deletions src/renderers/dom/client/wrappers/ReactDOMSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ var ReactDOMSelect = {
wasMultiple: Boolean(props.multiple),
};

if (props.value !== undefined && props.defaultValue !== undefined &&
!didWarnValueDefaultValue) {
if (
props.value !== undefined &&
props.defaultValue !== undefined &&
!didWarnValueDefaultValue
) {
warning(
false,
'Select elements must be either controlled or uncontrolled (specify either the ' +
'value prop, or the defaultValue prop, but not both). Decide between using a ' +
'controlled or uncontrolled select element and remove one of these props. More info: ' +
'Select elements must be either controlled or uncontrolled ' +
'(specify either the value prop, or the defaultValue prop, but not ' +
'both). Decide between using a controlled or uncontrolled select ' +
'element and remove one of these props. More info: ' +
'https://fb.me/react-controlled-components'
);
didWarnValueDefaultValue = true;
Expand Down
13 changes: 9 additions & 4 deletions src/renderers/dom/client/wrappers/ReactDOMTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ var ReactDOMTextarea = {
);
didWarnValueLink = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
if (
props.value !== undefined &&
props.defaultValue !== undefined &&
!didWarnValDefaultVal
) {
warning(
false,
'Textarea elements must be either controlled or uncontrolled (specify either the value ' +
'prop, or the defaultValue prop, but not both). Decide between using a controlled or ' +
'uncontrolled input and remove one of these props. More info: ' +
'Textarea elements must be either controlled or uncontrolled ' +
'(specify either the value prop, or the defaultValue prop, but not ' +
'both). Decide between using a controlled or uncontrolled textarea ' +
'and remove one of these props. More info: ' +
'https://fb.me/react-controlled-components'
);
didWarnValDefaultVal = true;
Expand Down
20 changes: 11 additions & 9 deletions src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ describe('ReactDOMInput', function() {
expect(() => ReactDOM.render(instance, node)).toThrow();
});

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ describe('ReactDOMSelect', function() {
expect(node.options[2].selected).toBe(false); // gorilla
});

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('ReactDOMTextarea', function() {
ReactDOM.unmountComponentAtNode(container);
});

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

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

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

Expand Down