@@ -77,6 +77,20 @@ describe('hideRootObjectTitle', () => {
7777 */
7878describe ( 'hideRootObjectTitle — RJSF root title/description derivation' , ( ) => {
7979 type Recorded = { title : unknown ; description : unknown ; properties : string [ ] } ;
80+ const rootTitleVisibleUiSchema = ( ( ) => {
81+ const existingOptions = importDesignUiSchema [ 'ui:options' ] ;
82+
83+ if ( typeof existingOptions !== 'object' || existingOptions === null || Array . isArray ( existingOptions ) ) {
84+ return importDesignUiSchema ;
85+ }
86+
87+ const { label : _label , ...otherOptions } = existingOptions ;
88+ return {
89+ ...importDesignUiSchema ,
90+ 'ui:options' : otherOptions
91+ } ;
92+ } ) ( ) ;
93+
8094 const recordRootRender = ( uiSchema : Record < string , unknown > ) : Recorded => {
8195 const recorded : Recorded = { title : undefined , description : undefined , properties : [ ] } ;
8296 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -104,8 +118,8 @@ describe('hideRootObjectTitle — RJSF root title/description derivation', () =>
104118 return recorded ;
105119 } ;
106120
107- it ( 'renders the canonical root title by default (the duplicative heading) ' , ( ) => {
108- const recorded = recordRootRender ( importDesignUiSchema ) ;
121+ it ( 'renders the canonical root title when root-label suppression is not applied ' , ( ) => {
122+ const recorded = recordRootRender ( rootTitleVisibleUiSchema ) ;
109123 expect ( recorded . title ) . toBe ( 'Import Design' ) ;
110124 } ) ;
111125
0 commit comments