Merge pull request #15279 from dagda1/nohtml5validate-on-next-stepper-form
configurable noHtml5Validate prop for NextScaffolderPage
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Added `noHtml5Validate` prop to `FormProps` on `NextScaffolderPage`
|
||||
@@ -168,7 +168,10 @@ export interface FieldSchema<TReturn, TUiOptions> {
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type FormProps = Pick<FormProps_3, 'transformErrors'>;
|
||||
export type FormProps = Pick<
|
||||
FormProps_3,
|
||||
'transformErrors' | 'noHtml5Validate'
|
||||
>;
|
||||
|
||||
// @public
|
||||
export type LayoutComponent<_TInputProps> = () => null;
|
||||
|
||||
@@ -54,11 +54,16 @@ describe('Router', () => {
|
||||
expect(TemplateWizardPage).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should pass through the transformErrors property', async () => {
|
||||
it('should pass through the FormProps property', async () => {
|
||||
const transformErrorsMock = jest.fn();
|
||||
|
||||
await renderInTestApp(
|
||||
<Router FormProps={{ transformErrors: transformErrorsMock }} />,
|
||||
<Router
|
||||
FormProps={{
|
||||
transformErrors: transformErrorsMock,
|
||||
noHtml5Validate: true,
|
||||
}}
|
||||
/>,
|
||||
{
|
||||
routeEntries: ['/templates/default/foo'],
|
||||
},
|
||||
@@ -66,13 +71,12 @@ describe('Router', () => {
|
||||
|
||||
const mock = TemplateWizardPage as jest.Mock;
|
||||
|
||||
const [
|
||||
{
|
||||
FormProps: { transformErrors },
|
||||
},
|
||||
] = mock.mock.calls[0];
|
||||
const [{ FormProps }] = mock.mock.calls[0];
|
||||
|
||||
expect(transformErrors).toEqual(transformErrors);
|
||||
expect(FormProps).toEqual({
|
||||
transformErrors: transformErrorsMock,
|
||||
noHtml5Validate: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should extract the fieldExtensions and pass them through', async () => {
|
||||
|
||||
@@ -20,4 +20,7 @@ import type { FormProps as SchemaFormProps } from '@rjsf/core-v5';
|
||||
*
|
||||
* @alpha
|
||||
*/
|
||||
export type FormProps = Pick<SchemaFormProps, 'transformErrors'>;
|
||||
export type FormProps = Pick<
|
||||
SchemaFormProps,
|
||||
'transformErrors' | 'noHtml5Validate'
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user