diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index 47fca9522fac8..1d4b76a286abf 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -1190,6 +1190,28 @@ describe('ReactDOMInput', () => { expect(firstRadioNode.checked).toBe(true); }); + it("shouldn't get tricked by changing radio names, part 2", () => { + ReactDOM.render( +
+ {}} /> + {}} /> +
, + container + ); + expect(container.querySelector('input[name="a"][value="1"]').checked).toBe(true); + expect(container.querySelector('input[name="a"][value="2"]').checked).toBe(false); + + ReactDOM.render( +
+ {}} /> + {}} /> +
, + container + ); + expect(container.querySelector('input[name="a"][value="1"]').checked).toBe(true); + expect(container.querySelector('input[name="b"][value="2"]').checked).toBe(true); + }); + it('should control radio buttons if the tree updates during render', () => { const sharedParent = container; const container1 = document.createElement('div');