Skip to content

Commit

Permalink
Added test to exclude blank breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley committed Jun 12, 2020
1 parent 00d87bf commit d3021bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class VueBreadcrumbs implements PluginObject<ComponentOptions<Vue>> {
},
this.$breadcrumbs.map((crumb: RouteRecord, index: number) => {
if (crumb?.meta?.breadcrumb) {
if (this.getBreadcrumb(crumb.meta.breadcrumb) === '') {
let label = this.getBreadcrumb(crumb.meta.breadcrumb);
if (label === '') {
console.log('Breadcrumb blank. Ignoring');
} else {
console.log('Breadcrumb valid', crumb?.meta?.breadcrumb);
Expand All @@ -99,7 +100,7 @@ class VueBreadcrumbs implements PluginObject<ComponentOptions<Vue>> {
tag: index !== this.$breadcrumbs.length - 1 ? 'a' : 'span'
}
},
` ${this.getBreadcrumb(crumb.meta.breadcrumb)}`
` ${label}`
)
]
)
Expand Down

0 comments on commit d3021bb

Please sign in to comment.