diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts index 2ac0561ee1..7289fcd6e5 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts @@ -61,7 +61,6 @@ describe('Breadcrumb', () => { component.root = 'default'; component.ngOnChanges({'folderNode': change}); - console.log(component.route); expect(component.route[0].name).toBe('default'); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts index 8b7e7a54da..23697b78cc 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts @@ -54,29 +54,29 @@ export class BreadcrumbComponent implements OnChanges { name: node.name }); - this.checkRoot(route); + if (this.root) { + route = this.checkRoot(route); + } this.route = route; } } } - private checkRoot(route) { - if (this.root) { - let isRoot = false; - route = route.filter((currentElement) => { - if (currentElement.name === this.root) { - isRoot = true; - } - return isRoot; - }); - - if (route.length === 0) { - route.push( { - id: undefined, - name: this.root - }); + private checkRoot(route: PathElementEntity[]): PathElementEntity[] { + let isRoot = false; + route = route.filter((currentElement) => { + if (currentElement.name === this.root) { + isRoot = true; } + return isRoot; + }); + + if (route.length === 0) { + route.push( { + id: undefined, + name: this.root + }); } return route; }