Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('does nothing on normal elements', () => {
mount(
{injectName('fieldB', )},
reactContext,
);
expect(Test.mock.calls[0]).toEqual(
expect.arrayContaining([expect.objectContaining({ name: 'fieldA' })]),
);
expect(Test.mock.calls[1]).not.toEqual(
expect.arrayContaining([
expect.objectContaining({ name: 'fieldA.fieldB' }),
]),
);
});
const Nest = ({ children, fields, itemProps, label, name, ...props }) => (
<div>
{label && <label>{label}</label>}
{children
? injectName(name, children)
: fields.map(key => (
))}
</div>
);
<div>
{label && (
<div>
<label>{label}</label>
</div>
)}
{!!(error && showInlineError) && (
<div>{errorMessage}</div>
)}
{children
? injectName(name, children)
: fields.map(key => (
))}
</div>
);
name,
showInlineError,
...props
}) => (
<div>
{label && <label>{label}</label>}
{!!(error && showInlineError) && (
<span>{errorMessage}</span>
)}
{children
? injectName(name, children)
: fields.map(key => (
))}
</div>
);
error,
errorMessage,
fields,
itemProps,
label,
name,
showInlineError,
...props
}) => (
<div>
{label && <label>{label}</label>}
{!!(error && showInlineError) && <div>{errorMessage}</div>}
{children
? injectName(name, children)
: fields.map(key => (
))}
</div>
);
const Nest = ({ children, fields, itemProps, label, name, ...props }) =>
wrapField(
{ ...props, component: undefined },
label && {label},
children
? injectName(name, children)
: fields.map(key => (
)),
);
name,
showInlineError,
...props
}) => (
<div>
{label && <label>{label}</label>}
{!!(error && showInlineError) && (
<span>{errorMessage}</span>
)}
{children
? injectName(name, children)
: fields.map((key: any) => (
))}
</div>
);