@@ -286,6 +286,43 @@ 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 ( of ( submissionState ) ) ;
299+ submissionServiceStub . getSubmissionSections . and . returnValue ( of ( sectionsList ) ) ;
300+
301+ comp . isLoading$ = of ( false ) ;
302+
303+ comp . uploadEnabled$ = of ( false ) ;
304+ } ) ;
305+
306+ it ( 'should display submission legend when shouldShowLegend is true' , ( ) => {
307+ spyOnProperty ( comp , 'shouldShowLegend' , 'get' ) . and . returnValue ( true ) ;
308+
309+ fixture . detectChanges ( ) ;
310+
311+ const legendElement = fixture . debugElement . nativeElement . querySelector ( 'ds-submission-legend' ) ;
312+ expect ( legendElement ) . toBeTruthy ( ) ;
313+ expect ( legendElement . classList . contains ( 'submission-form-header-legend' ) ) . toBe ( true ) ;
314+ } ) ;
315+
316+ it ( 'should not display submission legend when shouldShowLegend is false' , ( ) => {
317+ spyOnProperty ( comp , 'shouldShowLegend' , 'get' ) . and . returnValue ( false ) ;
318+
319+ fixture . detectChanges ( ) ;
320+
321+ const legendElement = fixture . debugElement . nativeElement . querySelector ( 'ds-submission-legend' ) ;
322+ expect ( legendElement ) . toBeNull ( ) ;
323+ } ) ;
324+ } ) ;
325+
289326 } ) ;
290327} ) ;
291328
0 commit comments