fix breadcrumb test

This commit is contained in:
Eugenio Romano
2017-06-23 15:20:09 +02:00
parent 0a7c8c99be
commit 6f6a0aca5d
2 changed files with 16 additions and 17 deletions

View File

@@ -61,7 +61,6 @@ describe('Breadcrumb', () => {
component.root = 'default'; component.root = 'default';
component.ngOnChanges({'folderNode': change}); component.ngOnChanges({'folderNode': change});
console.log(component.route);
expect(component.route[0].name).toBe('default'); expect(component.route[0].name).toBe('default');
}); });

View File

@@ -54,15 +54,16 @@ export class BreadcrumbComponent implements OnChanges {
name: node.name name: node.name
}); });
this.checkRoot(route); if (this.root) {
route = this.checkRoot(route);
}
this.route = route; this.route = route;
} }
} }
} }
private checkRoot(route) { private checkRoot(route: PathElementEntity[]): PathElementEntity[] {
if (this.root) {
let isRoot = false; let isRoot = false;
route = route.filter((currentElement) => { route = route.filter((currentElement) => {
if (currentElement.name === this.root) { if (currentElement.name === this.root) {
@@ -77,7 +78,6 @@ export class BreadcrumbComponent implements OnChanges {
name: this.root name: this.root
}); });
} }
}
return route; return route;
} }