@@ -286,6 +286,45 @@ describe('SubmissionFormComponent', () => {
286286 done ( ) ;
287287 } ) ;
288288
289+ describe ( 'submission legend' , ( ) => {
290+ beforeEach ( ( ) => {
291+ comp . collectionId = collectionId ;
292+ comp . submissionId = submissionId ;
293+ comp . submissionDefinition = submissionDefinition ;
294+ comp . selfUrl = selfUrl ;
295+ comp . sections = sectionsData ;
296+ comp . item = new Item ( ) ;
297+ comp . entityType = 'publication' ;
298+ submissionServiceStub . getSubmissionObject . and . returnValue ( observableOf ( submissionState ) ) ;
299+ submissionServiceStub . getSubmissionSections . and . returnValue ( observableOf ( sectionsList ) ) ;
300+
301+ // Mock isLoading$ to return false so the template renders
302+ comp . isLoading$ = observableOf ( false ) ;
303+
304+ // Mock uploadEnabled$ to ensure template renders properly
305+ comp . uploadEnabled$ = observableOf ( false ) ;
306+ } ) ;
307+
308+ it ( 'should display submission legend when shouldShowLegend is true' , ( ) => {
309+ spyOnProperty ( comp , 'shouldShowLegend' , 'get' ) . and . returnValue ( true ) ;
310+
311+ fixture . detectChanges ( ) ;
312+
313+ const legendElement = fixture . debugElement . nativeElement . querySelector ( 'ds-submission-legend' ) ;
314+ expect ( legendElement ) . toBeTruthy ( ) ;
315+ expect ( legendElement . classList . contains ( 'submission-form-header-legend' ) ) . toBe ( true ) ;
316+ } ) ;
317+
318+ it ( 'should not display submission legend when shouldShowLegend is false' , ( ) => {
319+ spyOnProperty ( comp , 'shouldShowLegend' , 'get' ) . and . returnValue ( false ) ;
320+
321+ fixture . detectChanges ( ) ;
322+
323+ const legendElement = fixture . debugElement . nativeElement . querySelector ( 'ds-submission-legend' ) ;
324+ expect ( legendElement ) . toBeNull ( ) ;
325+ } ) ;
326+ } ) ;
327+
289328 } ) ;
290329} ) ;
291330
0 commit comments