MCPcopy
hub / github.com/facebook/react / stub

Function stub

packages/react-dom/src/__tests__/ReactDOMInput-test.js:1263–1287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1261
1262 it('should set a value on a submit input', async () => {
1263 const stub = <input type="submit" value="banana" />;
1264 await act(() => {
1265 root.render(stub);
1266 });
1267 const node = container.firstChild;
1268
1269 expect(node.getAttribute('value')).toBe('banana');
1270 });
1271
1272 it('should not set an undefined value on a submit input', async () => {
1273 const stub = <input type="submit" value={undefined} />;
1274 await act(() => {
1275 root.render(stub);
1276 });
1277 const node = container.firstChild;
1278
1279 // Note: it shouldn't be an empty string
1280 // because that would erase the "submit" label.
1281 expect(node.getAttribute('value')).toBe(null);
1282
1283 await act(() => {
1284 root.render(stub);
1285 });
1286 expect(node.getAttribute('value')).toBe(null);
1287 });
1288
1289 it('should not set an undefined value on a reset input', async () => {
1290 const stub = <input type="reset" value={undefined} />;

Callers

nothing calls this directly

Calls 6

isCheckedDirtyFunction · 0.85
dispatchEventOnNodeFunction · 0.85
actFunction · 0.70
renderMethod · 0.65
toBeMethod · 0.65

Tested by

no test coverage detected