Skip to content

Commit 7a4ec79

Browse files
committed
Add test coverage for nodeName fix
1 parent cbde1e6 commit 7a4ec79

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

fixtures/dom/src/components/fixtures/text-inputs/index.js

+16
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ class TextInputFixtures extends React.Component {
7171
<InputTestCase type="url" defaultValue="" />
7272
</TestCase>
7373

74+
<TestCase title="Inputs with an id of `nodeName`">
75+
<TestCase.Steps>
76+
<li>Type any character</li>
77+
</TestCase.Steps>
78+
79+
<TestCase.ExpectedResult>
80+
There should be no errors in the console.
81+
</TestCase.ExpectedResult>
82+
83+
<form className="control-box">
84+
<fieldset>
85+
<input id="nodeName" />
86+
</fieldset>
87+
</form>
88+
</TestCase>
89+
7490
<TestCase title="All inputs" description="General test of all inputs">
7591
<InputTestCase type="text" defaultValue="Text" />
7692
<InputTestCase type="email" defaultValue="[email protected]"/>

src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js

+23
Original file line numberDiff line numberDiff line change
@@ -1346,4 +1346,27 @@ describe('ReactDOMInput', () => {
13461346
expect(node.getAttribute('value')).toBe('1');
13471347
});
13481348
});
1349+
1350+
it('an input with an id of `nodeName` works as intended', () => {
1351+
var spy = jest.fn();
1352+
1353+
class Test extends React.Component {
1354+
render() {
1355+
return (
1356+
<form onSubmit={spy}>
1357+
<input id="nodeName" name="nodeName" />
1358+
<input type="submit" />
1359+
</form>
1360+
);
1361+
}
1362+
}
1363+
1364+
var stub = ReactTestUtils.renderIntoDocument(<Test />);
1365+
var node = ReactDOM.findDOMNode(stub);
1366+
1367+
ReactTestUtils.Simulate.submit(node);
1368+
1369+
expect(spy).toHaveBeenCalled();
1370+
});
1371+
13491372
});

0 commit comments

Comments
 (0)