diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index 5afa9dcf7aa..3710fa40081 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -400,14 +400,20 @@ describe('ReactDOMInput', () => { it('should display "true" for `defaultValue` of `true`', () => { let stub = ; - const node = ReactDOM.render(stub, container); + let node; + expect(() => (node = ReactDOM.render(stub, container))).toWarnDev( + 'Received `true` for a non-boolean attribute `defaultValue`', + ); expect(node.value).toBe('true'); }); it('should display "false" for `defaultValue` of `false`', () => { let stub = ; - const node = ReactDOM.render(stub, container); + let node; + expect(() => (node = ReactDOM.render(stub, container))).toWarnDev( + 'Received `false` for a non-boolean attribute `defaultValue`', + ); expect(node.value).toBe('false'); }); @@ -1641,22 +1647,25 @@ describe('ReactDOMInput', () => { }); it('treats initial Symbol defaultValue as an empty string', function() { - ReactDOM.render(, container); + expect(() => + ReactDOM.render(, container), + ).toWarnDev('Invalid value for prop `defaultValue`'); + const node = container.firstChild; expect(node.value).toBe(''); expect(node.getAttribute('value')).toBe(''); - // TODO: we should warn here. }); it('treats updated Symbol defaultValue as an empty string', function() { ReactDOM.render(, container); - ReactDOM.render(, container); + expect(() => + ReactDOM.render(, container), + ).toWarnDev('Invalid value for prop `defaultValue`'); const node = container.firstChild; expect(node.value).toBe('foo'); expect(node.getAttribute('value')).toBe(''); - // TODO: we should warn here. }); }); @@ -1689,22 +1698,24 @@ describe('ReactDOMInput', () => { }); it('treats initial function defaultValue as an empty string', function() { - ReactDOM.render( {}} />, container); + expect(() => + ReactDOM.render( {}} />, container), + ).toWarnDev('Invalid value for prop `defaultValue`'); const node = container.firstChild; expect(node.value).toBe(''); expect(node.getAttribute('value')).toBe(''); - // TODO: we should warn here. }); it('treats updated function defaultValue as an empty string', function() { ReactDOM.render(, container); - ReactDOM.render( {}} />, container); + expect(() => + ReactDOM.render( {}} />, container), + ).toWarnDev('Invalid value for prop `defaultValue`'); const node = container.firstChild; expect(node.value).toBe('foo'); expect(node.getAttribute('value')).toBe(''); - // TODO: we should warn here. }); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js index fa5d717974a..0c40c1ff36f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js @@ -63,7 +63,10 @@ describe('ReactDOMTextarea', () => { it('should display "false" for `defaultValue` of `false`', () => { const stub =