Skip to content

Commit

Permalink
Changed the error message displayed when a select element with props.…
Browse files Browse the repository at this point in the history
…multiple set to true and value set to null to suggest an empty array instead of an empty string. Addresses issue 9038
  • Loading branch information
nealwright committed Oct 7, 2017
1 parent 4131af3 commit 41949e5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ function validateProperties(type, props) {
warning(
false,
'`value` prop on `%s` should not be null. ' +
'Consider using the empty string to clear the component or `undefined` ' +
'Consider using an empty %s to clear the component or `undefined` ' +
'for uncontrolled components.%s',
type,
type === 'select' ? 'array' : 'string',
getStackAddendum(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ describe('ReactDOMInput', () => {
ReactTestUtils.renderIntoDocument(<input type="text" value={null} />);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'`value` prop on `input` should not be null. ' +
'Consider using the empty string to clear the component or `undefined` ' +
'Consider using an empty string to clear the component or `undefined` ' +
'for uncontrolled components.',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ describe('ReactDOMSelect', () => {
);
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` ' +
'Consider using an empty array to clear the component or `undefined` ' +
'for uncontrolled components.',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ describe('ReactDOMTextarea', () => {
ReactTestUtils.renderIntoDocument(<textarea value={null} />);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'`value` prop on `textarea` should not be null. ' +
'Consider using the empty string to clear the component or `undefined` ' +
'Consider using an empty string to clear the component or `undefined` ' +
'for uncontrolled components.',
);

Expand Down

0 comments on commit 41949e5

Please sign in to comment.