diff --git a/projects/common/src/navigation/breadcrumb.ts b/projects/common/src/navigation/breadcrumb.ts index edca89b8d..fd569993b 100644 --- a/projects/common/src/navigation/breadcrumb.ts +++ b/projects/common/src/navigation/breadcrumb.ts @@ -3,4 +3,5 @@ export interface Breadcrumb { icon?: string; url?: string[]; hide?: boolean; + alwaysShowIcon?: boolean; } diff --git a/projects/components/src/breadcrumbs/breadcrumbs.component.test.ts b/projects/components/src/breadcrumbs/breadcrumbs.component.test.ts index b13c81846..d13c86f34 100644 --- a/projects/components/src/breadcrumbs/breadcrumbs.component.test.ts +++ b/projects/components/src/breadcrumbs/breadcrumbs.component.test.ts @@ -30,16 +30,20 @@ describe('BreadcrumbsComponent', () => { label: 'First', type: 'First Type', icon: 'firstIcon', - url: ['first', 'second'] + url: ['first', 'second'], + alwaysShowIcon: false }, { - label: 'Second' + label: 'Second', + icon: 'secondIcon', + alwaysShowIcon: true }, { label: 'Third', type: 'Third Type', - icon: 'secondIcon', - url: ['first', 'second', 'third'] + icon: 'thirdIcon', + url: ['first', 'second', 'third'], + alwaysShowIcon: false } ] } @@ -53,12 +57,20 @@ describe('BreadcrumbsComponent', () => { expect(spectator.queryAll('.breadcrumbs .breadcrumb').length).toBe(3); }); - it('should show icon only on the first crumb', () => { + it('should show icon on the first crumb', () => { const crumbs = spectator.queryAll('.breadcrumbs .breadcrumb'); expect(crumbs[0].querySelector('ht-icon')).toExist(); + }); - crumbs.shift(); - crumbs.forEach(crumb => expect(crumb.querySelector('ht-icon')).toBeNull()); + it('should display the icon', () => { + const crumbs = spectator.queryAll('.breadcrumbs .breadcrumb'); + crumbs.forEach((crumb, index) => { + if (index < crumbs.length - 1) { + expect(crumb.querySelector('ht-icon')).toExist(); + } else { + expect(crumb.querySelector('ht-icon')).toBeNull(); + } + }); }); it('should make last crumb inactive', () => { diff --git a/projects/components/src/breadcrumbs/breadcrumbs.component.ts b/projects/components/src/breadcrumbs/breadcrumbs.component.ts index dda764e1c..70664d354 100644 --- a/projects/components/src/breadcrumbs/breadcrumbs.component.ts +++ b/projects/components/src/breadcrumbs/breadcrumbs.component.ts @@ -18,7 +18,7 @@ import { IconSize } from '../icon/icon-size'; >