Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' into patch-1
  • Loading branch information
vcarl committed Jan 2, 2020
commit b59eba2700a773335821d0f9c228d96d1a6b6097
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('DOMPropertyOperations', () => {
<input type="text" onChange={function() {}} />,
container,
),
).toWarnDev(
).toErrorDev(
'A component is changing a controlled input to be uncontrolled',
);
if (disableInputAttributeSyncing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('ReactDOMComponentTree', () => {

const component = <Controlled />;
const instance = ReactDOM.render(component, container);
expect(() => simulateInput(instance.a, finishValue)).toWarnDev(
expect(() => simulateInput(instance.a, finishValue)).toErrorDev(
'Warning: A component is changing an uncontrolled input to be ' +
'controlled. This is likely caused by the value changing from ' +
'a defined to undefined, which should not happen. ' +
Expand Down
40 changes: 20 additions & 20 deletions packages/react-dom/src/__tests__/ReactDOMInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ describe('ReactDOMInput', () => {
expect(node.value).toBe('0');
expect(() =>
ReactDOM.render(<input type="text" defaultValue="1" />, container),
).toWarnDev(
).toErrorDev(
'A component is changing a controlled input to be uncontrolled.',
);
expect(node.value).toBe('0');
Expand Down Expand Up @@ -852,7 +852,7 @@ describe('ReactDOMInput', () => {
<input type="submit" value={undefined} onChange={emptyFunction} />,
container,
),
).toWarnDev(
).toErrorDev(
'A component is changing a controlled input to be uncontrolled.',
);

Expand All @@ -871,7 +871,7 @@ describe('ReactDOMInput', () => {
<input type="reset" value={undefined} onChange={emptyFunction} />,
container,
),
).toWarnDev(
).toErrorDev(
'A component is changing a controlled input to be uncontrolled.',
);

Expand Down Expand Up @@ -1264,7 +1264,7 @@ describe('ReactDOMInput', () => {
<input type="text" value="controlled" onChange={emptyFunction} />
);
ReactDOM.render(stub, container);
expect(() => ReactDOM.render(<input type="text" />, container)).toWarnDev(
expect(() => ReactDOM.render(<input type="text" />, container)).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand Down Expand Up @@ -1303,7 +1303,7 @@ describe('ReactDOMInput', () => {
<input type="text" defaultValue="uncontrolled" />,
container,
),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1318,7 +1318,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="text" value="controlled" />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -1336,7 +1336,7 @@ describe('ReactDOMInput', () => {
);
expect(() =>
ReactDOM.render(<input type="text" value="controlled" />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -1353,7 +1353,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="checkbox" />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1370,7 +1370,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="checkbox" checked={null} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1390,7 +1390,7 @@ describe('ReactDOMInput', () => {
<input type="checkbox" defaultChecked={true} />,
container,
),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1405,7 +1405,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="checkbox" checked={true} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -1420,7 +1420,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="checkbox" checked={true} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -1433,7 +1433,7 @@ describe('ReactDOMInput', () => {
it('should warn if controlled radio switches to uncontrolled (checked is undefined)', () => {
const stub = <input type="radio" checked={true} onChange={emptyFunction} />;
ReactDOM.render(stub, container);
expect(() => ReactDOM.render(<input type="radio" />, container)).toWarnDev(
expect(() => ReactDOM.render(<input type="radio" />, container)).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1448,7 +1448,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="radio" checked={null} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1463,7 +1463,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="radio" defaultChecked={true} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand All @@ -1478,7 +1478,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="radio" checked={true} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -1493,7 +1493,7 @@ describe('ReactDOMInput', () => {
ReactDOM.render(stub, container);
expect(() =>
ReactDOM.render(<input type="radio" checked={true} />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand Down Expand Up @@ -1546,7 +1546,7 @@ describe('ReactDOMInput', () => {
);
expect(() =>
ReactDOM.render(<input type="radio" value="value" />, container),
).toWarnDev(
).toErrorDev(
'Warning: A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand Down Expand Up @@ -1829,7 +1829,7 @@ describe('ReactDOMInput', () => {
}

it('reverts the value attribute to the initial value', () => {
expect(renderInputWithStringThenWithUndefined).toWarnDev(
expect(renderInputWithStringThenWithUndefined).toErrorDev(
'A component is changing a controlled input to be uncontrolled.',
);
if (disableInputAttributeSyncing) {
Expand All @@ -1840,7 +1840,7 @@ describe('ReactDOMInput', () => {
});

it('preserves the value property', () => {
expect(renderInputWithStringThenWithUndefined).toWarnDev(
expect(renderInputWithStringThenWithUndefined).toErrorDev(
'A component is changing a controlled input to be uncontrolled.',
);
expect(input.value).toBe('latest');
Expand Down
6 changes: 2 additions & 4 deletions packages/react-dom/src/client/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ export function updateWrapper(element: Element, props: Object) {
controlled &&
!didWarnUncontrolledToControlled
) {
warning(
false,
console.error(
'A component is changing an uncontrolled input to be controlled. ' +
'This is likely caused by the value changing from a defined to ' +
'undefined, which should not happen. ' +
Expand All @@ -155,8 +154,7 @@ export function updateWrapper(element: Element, props: Object) {
!controlled &&
!didWarnControlledToUncontrolled
) {
warning(
false,
console.error(
'A component is changing a controlled input to be uncontrolled. ' +
'This is likely caused by the value changing from undefined to ' +
'a defined value, which should not happen. ' +
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.