feat: support title if present in schema definition
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -435,6 +435,35 @@ describe('ReviewState', () => {
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should allow using the title property', async () => {
|
||||
const formState = {
|
||||
foo: 'test',
|
||||
};
|
||||
|
||||
const schemas: ParsedTemplateSchema[] = [
|
||||
{
|
||||
mergedSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
foo: {
|
||||
type: 'string',
|
||||
title: 'Test Thing',
|
||||
},
|
||||
},
|
||||
},
|
||||
schema: {},
|
||||
title: 'test',
|
||||
uiSchema: {},
|
||||
},
|
||||
];
|
||||
|
||||
const { queryByRole } = render(
|
||||
<ReviewState formState={formState} schemas={schemas} />,
|
||||
);
|
||||
|
||||
expect(queryByRole('row', { name: 'Test Thing test' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should allow custom review name', async () => {
|
||||
const formState = {
|
||||
foo: 'test',
|
||||
|
||||
@@ -41,7 +41,10 @@ function processSchema(
|
||||
data: formState,
|
||||
});
|
||||
|
||||
const name = definitionInSchema?.['ui:backstage']?.review?.name ?? key;
|
||||
const name =
|
||||
definitionInSchema?.['ui:backstage']?.review?.name ??
|
||||
definitionInSchema?.title ??
|
||||
key;
|
||||
|
||||
if (definitionInSchema) {
|
||||
const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;
|
||||
|
||||
Reference in New Issue
Block a user